Howtos / Articles

Reload HAProxy Config with Minimal Downtime

Restarting HAProxy using the default init scripts will kill any existing connections, and prevent any new connections while it restarts. With the init script restart method (eg ‘/etc/init.d/haproxy restart’), if there are any configuration errors, the service wont start up again. This might be fine for low volume sites, but if you are dealing with heavy traffic, you would want to reload the configuration with the smallest amount of downtime possible.

Thankfully HAProxy provides the ability to do this. The ‘-st’ and ‘-sf’ parameter options are used for hot configuration changes.

Both parameter options allow for hot configuration changes, with the difference being that the ‘-st’ option forces the existing HAProxy instance to kill all existing connections, where as the ‘-sf’ option tells the existing HAProxy instance to finish doing any work, and then softly close.

If there are any configuration errors in the config file, HAProxy will not complete the configuration reload, and will remain running with the existing config.

Example of a configuration reload using -sf (wait for HAProxy to finish any ‘work’):

$ sudo haproxy -p /var/run/ -sf $(cat /var/run/

Share this howto article!
  • Facebook
  • Twitter
  • Reddit
  • email

1 comment to Reload HAProxy Config with Minimal Downtime

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>