문제
I am trying to restart haproxy, when I type
haproxy -f /etc/haproxy/haproxy.cfg
I get the following error:
[ALERT] 212/124840 (9060) : Starting proxy mysql-cluster: cannot bind socket
If I type
/etc/init.d/haproxy restart
nothing happens.
해결책
Two options:
You aren't running as root; probably needs a sudo in front of your command to start it on the command line if you aren't running as root (check with whoami). Another process, likely another instance of HAProxy, is already bound to those ports. Check with netstat -apn.
다른 팁
Many a times starting HAProxy service gives error for like
HAProxy cannot bind socket [0.0.0.0:port]
For resolving this issue check for another process, likely another instance of HAProxy, is already bound to those ports. Check with netstat -apn.
Kill the other instance of HAProxy.
If this didn't resolve your problem or there is no other process running. You may run the following command. This is resolve the issue.
setsebool -P haproxy_connect_any=1