HAProxy重新启用服务器时,再次启动

我试图确定,当一个服务器在closures后(而不再活动)时,它会自动重新启用。

这是我的haproxy.cfg:

global log 127.0.0.1 local0 log 127.0.0.1 local1 notice chroot /var/lib/haproxy user haproxy group haproxy # daemon defaults log global mode tcp #retries 3 option tcplog option dontlognull option redispatch no option persist #balance roundrobin balance leastconn timeout connect 5000ms timeout client 50000ms timeout server 50000ms errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http listen stats 0.0.0.0:9000 #Listen on all IP's on port 9000 mode http balance timeout client 5000 timeout connect 4000 timeout server 30000 #This is the virtual URL to access the stats page stats uri /haproxy_stats #Authentication realm. This can be set to anything. Escape space characters with a backslash. stats realm HAProxy\ Statistics #The user/pass you want to use. Change this password! stats auth admin:adminpassword #This allows you to take down and bring up back end servers. #This will produce an error on older versions of HAProxy. stats admin if TRUE # FRONTEND - NON-SSL frontend www-http bind *:80 # detect capacity issues in production farm acl MAIN_not_enough_capacity nbsrv(www-unsecure-backend-proxy) le 2 # failover traffic to backup farm use_backend www-unsecure-backend-direct if MAIN_not_enough_capacity default_backend www-unsecure-backend-proxy # BACKEND - NON-SSL backend www-unsecure-backend-proxy mode tcp server rproxycache01 rpcache01.container:80 check server rproxycache02 rpcache02.container:80 check # FALLBACK - NON-SSL backend www-unsecure-backend-direct option allbackups server rproxycache01 rpcache01.container:80 check server rproxycache02 rpcache02.container:80 check server frontend01 web01.container:80 check backup server frontend02 web02.container:80 check backup 

所以,假设所有的服务器都closures了,只要有人回来,就应该使用它,但是我已经检查了Web界面,所有的服务器都是红色的。

我该怎么做?

先谢谢你。

我会说全局设置retries 3给你造成问题。 3次重试后,HAProxy将放弃进一步检查。 请参阅retries指令的文档。

由于您没有设置值 ,HAProxy将每2秒检查一次服务器可用性。 如果您的服务器不可用超过6秒钟,HAProxy会认为它永久closures。

我build议你注释retries 3行(或设置更大的值)和/或调整check inter值,重新启动HAProxy并重做testing。