1

When im starting HAProxy it says:

Starting haproxy: [ALERT] 038/154339 (770) : Starting proxy proxy1: cannot bind socket                                                            [FAILED]

My config:

global
daemon
log /dev/log local4
maxconn 400000
ulimit-n 810000

defaults
log global
contimeout 4000
clitimeout 42000
srvtimeout 43000

listen proxy1 31.***.50.247:8217
mode tcp
balance leastconn
server proxy1_1  198.**.**0.70:25565

A bit of my IPs are hidden from serverfault.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
xCoderTV
  • 13
  • 1
  • 5

2 Answers2

2

Assuming this is RHEL or some derivative, if you have SELinux on it probably wouldn't appreciate you running haproxy on a port the policy is not familiar with.

Try restarting the process, let it fail. Then run ausearch -ts recent -m avc. If its coming back with results (text), then try doing these two commands.

semanage port -a -p tcp -t commplex_port_t 8217
semanage port -a -p tcp -t commplex_port_t 25565

This will ammend the SELinux policy to be aware that haproxy is is listening on these ports.

The strange label "commplex_port_t" is the type definition of port 5000 which (I assume) haproxy defaults to if you dont choose a port. In /etc/services port 5000 claims is registered to the commplex-main service, hence the name of the label being out of place.

Matthew Ife
  • 22,927
  • 2
  • 54
  • 71
1
cannot bind socket [FAILED]

That typically means one of two things:

  1. There is already another daemon listening on that port.
  2. You're using a port below 1024 and you're running haproxy as a non-privileged user.

Since it looks like you're using port 8217 and 25565, #2 isn't the case.

To determine if there is already something listening on that port:

$ sudo netstat -tunlp | grep 8217
EEAA
  • 108,414
  • 18
  • 172
  • 242