Haproxy 1.8.3 seamless reload refresh health checks


Hello All.
When haproxy seamless reload config file, all health checks refresh to state “ok”, so backends become UP and receiving connections for few seconds.

Haproxy starts by command:
haproxy -D -f /usr/local/etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -x /var/run/haproxy.sock -sf $(cat /var/run/haproxy.pid)

Haproxy cfg for nbproc >1 has string:
stats socket /var/run/haproxy.sock mode 660 level admin expose-fd listeners process 1

and health check strings:

  1. Before reload:
    dump the current states to file, using haproxy stats socket and command “show servers state”
  2. Set haproxy.cfg to read this file like:
    server-state-file-name /tmp/haproxy_server_states
    load-server-state-from-file local