Use Haproxy in production environment, often encounter haproxy false alarm "backend xxx_server has no server available!" message, and in fact,xxx_server is functioning normally.
More and more recent false positives, has seriously affected the use of the server, a few months ago or google some information, have not determined the problem. So decided to spare time from the source of Haproxy to find out why.
Carefully found in the source code of the Haproxy, found that the TCP connection returned errors caused by false positives. A haproxy is then redeployed on a test server to prepare for debugging specific TCP error messages.
Interestingly, the new deployment of the test haproxy incredibly normal, no false positives.
Compared with the two servers, the network parameters are mainly the production environment of the kernel TCP parameters have been optimized, and the test environment is the system default.
The following optimizations were made in the/etc/sysctl.conf file before the production environment:
Kernel.shmall = 268435456net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_ Fin_timeout = 30net.ipv4.tcp_keepalive_time = 1200net.ipv4.ip_local_port_range = 1024x768 65000net.ipv4.tcp_max_tw_ Buckets = 5000net.ipv4.tcp_max_tw_buckets = 5000net.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_time = 300net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.ip_local_port_range = 5000 65000net.ipv4.tcp_mem = 786432 1048576 1572864net.core.wmem_max = 873200net.core.rmem_max = 873200net.ipv4.tcp_wmem = 8192 436600 873200net.ipv4.tcp_rmem = 32768 436600 873200net.core.somaxconn = 256net.core.netdev_max_backlog = 1000net.ipv4.tcp_max_syn_backlog = 2048net.ipv4.tcp_retries2 = 5net.ipv4.tcp_keepalive_time = 500net.ipv4.tcp_ KEEPALIVE_INTVL = 30net.ipv4.tcp_keepalive_probes = 3net.ipv4.conf.lo.arp_ignore = 0net.ipv4.conf.lo.arp_announce = 0net.ipv4.conf.all.arp_ignore = 0net.ipv4.conf.all.arp_announce = 0
It seems that this is the cause of haproxy in the health check, and then remove the above configuration, restart the production environment of the server, everything is OK.
Resolve Haproxy false positives "backend Xxx_server has no server available!"