Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We want to be able to add more backend servers on demand. Right now I don't see a way to add more backend servers to the config file without restarting haproxy.

share|improve this question
up vote 12 down vote accepted

I haven't tested this specific use case but haproxy does support a "hot reload":

2.4.1) Hot reconfiguration
The '-st' and '-sf' command line options are used to inform previously running
processes that a configuration is being reloaded. They will receive the SIGTTOU
signal to ask them to temporarily stop listening to the ports so that the new
process can grab them. If anything wrong happens, the new process will send
them a SIGTTIN to tell them to re-listen to the ports and continue their normal
work. Otherwise, it will either ask them to finish (-sf) their work then softly
exit, or immediately terminate (-st), breaking existing sessions. A typical use
of this allows a configuration reload without service interruption :

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

If you have an init script to start and stop haproxy it likely supports the reload argument with a function like:

        || return 2
    return 0
share|improve this answer
I've tried this but I've found that it clears my counters. Perhaps am I doing something the wrong way, or is it expected behaviour? – Leandro López Nov 20 '10 at 3:19

From the manual:

> 1.6) Helping process management

Haproxy now supports the notion of pidfile. If the '-p' command line argument, or the 'pidfile' global option is followed with a file name, this file will be removed, then filled with all children's pids, one per line (only in daemon mode). This file is NOT within the chroot, which allows to work with a readonly chroot. It will be owned by the user starting the process, and will have permissions 0644.

Example :

    nbproc  2
    pidfile /var/run/

# to stop only those processes among others :
# kill $(</var/run/

# to reload a new configuration with minimal service impact and without
# breaking existing sessions :
# haproxy -f haproxy.cfg -p /var/run/ -sf $(</var/run/
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.