问题原文
原帖链接 · Conor Taylor · CC BY-SA 3.0
I'm running an HAProxy load balancing server to balance load to multiple Apache servers. I need to reload HAProxy at any given time in order to change the load balancing algorithm.
This all works fine, except for the fact that I have to reload the server without losing a single packet (at the moment a reload is giving me 99.76% success on average, with 1000 requests per second for 5 seconds). I have done many hours of research about this, and have found the following command for "gracefully reloading" the HAProxy server:
haproxy -D -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
However, this has little or no effect versus the plain old service haproxy reload, it's still dropping 0.24% on average.
Is there any way of reloading the HAProxy config file without a single dropped packet from any user?
已采纳解答
原帖链接 · Mxx · CC BY-SA 3.0
According to https://github.com/aws/opsworks-cookbooks/pull/40 and consequently http://www.mail-archive.com/[email omitted]/msg06885.html you can:
iptables -I INPUT -p tcp --dport $PORT --syn -j DROP
sleep 1
service haproxy restart
iptables -D INPUT -p tcp --dport $PORT --syn -j DROP
This has the effect of dropping the SYN before a restart, so that clients will resend this SYN until it reaches the new process.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
