If you don’t want to loose all of your current connections, you need to get haproxy to reload the new configuration without stopping and starting.
# haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid)
The -sf
flag is for a soft reset.
Does this works for long running tcp connections i read -sf wait for connection to complete and then reset, when if connection is a long running tcp connection hot http calls
It’s not a true zero downtime reload. It’s more of a superfast switch over from an old thread to a new thread. I have had good luck with long running TCP connections.
see yelp engineering blog for more information about how they handled this: https://engineeringblog.yelp.com/2015/04/true-zero-downtime-haproxy-reloads.html
and this thread is very valid as well: https://news.ycombinator.com/item?id=9369051
The following commadn will do it for you , per HAProxy documentations
sudo /etc/init.d/haproxy reload
Thank you for your keeping this post current. At the time of this writing (over 4 years ago) this functionality was not available in the haproxy init script that shipped with debian.
This does not work and you can test it with ab to prove it. With a concurrence of 10 you will a reset from the LB
Thank you for your comment. This has been addressed in the comment from 2017-03-08