could not bind socket while haproxy restart

Solution 1:

On RedHat Linux with enabled SELinux (which should be enabled), just enable the haproxy_connect_any boolean value, which allows haproxy to connect the socket to any port:

setsebool -P haproxy_connect_any on

Solution 2:

Two options:

  1. 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).
  2. Another process, likely another instance of HAProxy, is already bound to those ports. Check with netstat -apn.

Solution 3:

Maybe is because of selinux I type

setenforce 0

and solve the problem. The command is to make selinux to premissive mode. A not proper set selinux may block many service or connection.