mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-23 21:22:17 +00:00
a8ee4b199f
The following example files awere removed as irrelevant by this time : auth.cfg check.conf ssl.cfg haproxy.spec The following scripts were removed as having been unused for more than a decade : debug2ansi debug2html debugfind check init.haproxy stats_haproxy.sh seemless_reload.txt was moved to doc/ where it's more suitable. haproxy.vim was moved to contrib/syntax-highlight/ scripts/create-release was updated not to try to update haproxy.spec anymore.
63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
Reloading HAProxy without impacting server states
|
|
=================================================
|
|
|
|
Of course, to fully understand below information please consult
|
|
doc/configuration.txt to understand how each HAProxy directive works.
|
|
|
|
In the mean line, we update HAProxy's configuration to tell it where to
|
|
retrieve the last know trustable servers state.
|
|
Then, before reloading HAProxy, we simply dump servers state from running
|
|
process into the locations we pointed into the configuration.
|
|
And voilà :)
|
|
|
|
|
|
Using one file for all backends
|
|
-------------------------------
|
|
|
|
HAProxy configuration
|
|
*********************
|
|
|
|
global
|
|
[...]
|
|
stats socket /var/run/haproxy/socket
|
|
server-state-file global
|
|
server-state-base /var/state/haproxy/
|
|
|
|
defaults
|
|
[...]
|
|
load-server-state-from-file global
|
|
|
|
HAProxy init script
|
|
*******************
|
|
|
|
Run the following command BEFORE reloading:
|
|
|
|
socat /var/run/haproxy/socket - <<< "show servers state" > /var/state/haproxy/global
|
|
|
|
|
|
Using one state file per backend
|
|
--------------------------------
|
|
|
|
HAProxy configuration
|
|
*********************
|
|
|
|
global
|
|
[...]
|
|
stats socket /var/run/haproxy/socket
|
|
server-state-base /var/state/haproxy/
|
|
|
|
defaults
|
|
[...]
|
|
load-server-state-from-file local
|
|
|
|
HAProxy init script
|
|
*******************
|
|
|
|
Run the following command BEFORE reloading:
|
|
|
|
for b in $(socat /var/run/haproxy/socket - <<< "show backend" | fgrep -v '#')
|
|
do
|
|
socat /var/run/haproxy/socket - <<< "show servers state $b" > /var/state/haproxy/$b
|
|
done
|
|
|