使用Ubuntu作为我的服务器我试图设置负载平衡使用HAProxy。
当我尝试使用“haproxy -f haproxy.cfg”运行时出现此错误。
[警告] 035/115820(1148):[haproxy.main()]无法将FD限制提高到8224. [ALERT] 035/115820(1148):启动代理webservice:无法绑定套接字
我认为释放port80可以解决问题,所以我卸载了可能使用port80的apache2。 但无济于事依然没有解决我的问题。 那么我怎样才能杀死一个使用80端口的应用呢?
我的haproxy.cfg
# this config needs haproxy-1.1.28 or haproxy-1.2.1 global log 127.0.0.1 local0 log 127.0.0.1 local1 notice #log loghost local0 info maxconn 4096 #chroot /usr/share/haproxy user haproxy group haproxy daemon #debug #quiet defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 listen webservice 192.168.1.120:80 mode http stats enable stats refresh 10s stats hide-version cookie GALAXY insert balance roundrobin option httpclose option httpchk OPTIONS /health_check.html option forwardfor server RONAHPC 192.168.1.7:80 cookie GALAXY_SERVER_01 check server MAANPC 192.168.101:80 cookie GALAXY_SERVER_02 check
netstat -anop | grep ":80"
这应该告诉你什么是在该端口上收听。 例如:
~]# netstat -anop | grep ":80" tcp 0 0 :::80 :::* LISTEN 15566/httpd off (0.00/0/0)
你也可以使用:lsof -Pni | grep“:80”
例如:
~]# lsof -Pni | grep ":80" httpd 15566 apache 4u IPv6 6247436 0t0 TCP *:80 (LISTEN) httpd 19069 root 4u IPv6 6247436 0t0 TCP *:80 (LISTEN)
通过纠正我的服务器的公共IP。 原来我使用的IP地址不是具有当前安装的负载平衡器的服务器的IP地址。
修复这条线解决了我的问题
听web服务192.168.1.120:80
我和@ tom-angelo-clemente有同样的问题,但是通过在前端的bind参数上使用广播地址来解决这个问题:
frontend wfe bind 0.0.0.0:80
这会将代理绑定到计算机正在使用的任何IP地址(不确定不同NIC设备上的地址),所以如果您有一个专用pipe理接口和您不想绑定的地址,请谨慎使用此方法。