DOC: add documentation for the master-worker mode
diff --git a/doc/configuration.txt b/doc/configuration.txt
index ad7d3a8..5fa49d3 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -803,6 +803,20 @@
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 @@
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
diff --git a/doc/management.txt b/doc/management.txt
index 64d6a2d..df091bb 100644
--- a/doc/management.txt
+++ b/doc/management.txt
@@ -160,8 +160,6 @@
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 @@
-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 @@
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.