DOC: add documentation for the master-worker mode

This commit is contained in:
William Lallemand 2017-06-01 17:38:56 +02:00 committed by Willy Tarreau
parent e20b6a62f8
commit e202b1e951
2 changed files with 29 additions and 2 deletions

View File

@ -803,6 +803,20 @@ lua-load <file>
This global directive loads and executes a Lua file. This directive can be
used multiple times.
master-worker [exit-on-failure]
Master-worker mode. It is equivalent to the command line "-W" argument.
This mode will launch a "master" which will monitor the "workers". Using
this mode, you can reload HAProxy directly by sending a SIGUSR2 signal to
the master. The master-worker mode is compatible either with the foreground
or daemon mode. It is recommended to use this mode with multiprocess and
systemd.
The "exit-on-failure" option allows the master to kill every workers and
exit when one of the current workers died. It is convenient to combine this
option with Restart=on-failure in a systemd unit file in order to relaunch
the whole process.
See alors "-W" in the management guide.
nbproc <number>
Creates <number> processes when going daemon. This requires the "daemon"
mode. By default, only one process is created, which is the recommended mode
@ -10431,6 +10445,8 @@ defer-accept
expose-fd listeners
This option is only usable with the stats socket. It gives your stats socket
the capability to pass listeners FD to another HAProxy process.
During a reload with the master-worker mode, the process is automatically
reexecuted adding -x and one of the stats socket with this option.
See alors "-x" in the management guide.
force-sslv3

View File

@ -160,8 +160,6 @@ list of options is :
configuration. It is recommended to always force it in any init script so
that a faulty configuration doesn't prevent the system from booting.
-Ds : work in systemd mode. Only used by the systemd wrapper.
-L <name> : change the local peer name to <name>, which defaults to the local
hostname. This is used only with peers replication.
@ -171,6 +169,13 @@ list of options is :
-V : enable verbose mode (disables quiet mode). Reverts the effect of "-q" or
"quiet".
-W : master-worker mode. It is equivalent to the "master-worker" keyword in
the "global" section of the configuration. This mode will launch a "master"
which will monitor the "workers". Using this mode, you can reload HAProxy
directly by sending a SIGUSR2 signal to the master. The master-worker mode
is compatible either with the foreground or daemon mode. It is
recommended to use this mode with multiprocess and systemd.
-c : only performs a check of the configuration files and exits before trying
to bind. The exit status is zero if everything is OK, or non-zero if an
error is encountered.
@ -419,6 +424,12 @@ reload or restart, so that they are sent at the latest possible moment and only
if absolutely required. This is what is performed by the "-st" (hard) and "-sf"
(graceful) options respectively.
In master-worker mode, it is not needed to start a new haproxy process in
order to reload the configuration. The master process reacts to the SIGUSR2
signal by reexecuting itself with the -sf parameter followed by the PIDs of
the workers. The master will then parse the configuration file and fork new
workers.
To understand better how these signals are used, it is important to understand
the whole restart mechanism.