Haproxy绑定错误

你好有StackOverflow,

我似乎与我的haproxy有一个错误,这是我得到的,当我尝试和运行它

[ALERT] 208/051346 (5865) : Starting proxy ah1: cannot bind socket [ALERT] 208/051346 (5865) : Starting proxy ah2: cannot bind socket 

我正在运行这个TCP代理

这是我的configuration:

 #--------------------------------------------------------------------- # Example configuration for a possible web application. See the # full configuration options online. # # http://haproxy.1wt.eu/download/1.3/doc/configuration.txt # #--------------------------------------------------------------------- #--------------------------------------------------------------------- # Global settings #--------------------------------------------------------------------- global log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon #--------------------------------------------------------------------- # common defaults that all the 'listen' and 'backend' sections will # use if not designated in their block #--------------------------------------------------------------------- defaults mode tcp log global option dontlognull option forwardfor option redispatch timeout connect 10000 # default 10 second time out if a backend is not found timeout client 300000 timeout server 300000 maxconn 60000 retries 3 listen ah1 207.254.9.41:30000 mode tcp balance leastconn server ah1_1 46.16.77.23:30000 listen ah2 207.254.9.41:30001 mode tcp balance leastconn server ah2_1 46.16.77.23:30001 

我们正在运行红帽企业Linux 5(x64)

使用端口30000和30001检查已经存在的进程:

lsof -i或netstat -lnp

如果您没有在端口30000或30001上侦听任何内容,请确保您具有在系统上实际配置的IP地址207.254.9.41:

ip地址或ifconfig

如果您没有看到列出的207.254.9.41,则可以将其更改为正确的IP地址,或者直接关闭IP地址:

:30000而不是207.254.9.41:30000

如果没有一个修复它,那么我建议升级到1.4或1.5(我已经在一个非常大的生产环境中使用1.5几乎一年没有问题)。 如果1.4和1.5不在软件包库中,那么我建议编译自己。

可能是你在那台服务器上运行apache,它使用的是你在Haproxy上使用的同一个端口。 那么只需停止使用haproxy上使用的同一端口的应用程序,然后重新启动它。 它应该工作。

谢谢