Last active
October 6, 2022 15:50
-
-
Save haproxytechblog/aec210a88c10d0e864dd373f5df17f89 to your computer and use it in GitHub Desktop.
Preserve stick table data when reloading HAProxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peers mypeers | |
peer garfield 127.0.0.1:10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
localpeer odie | |
peers mypeers | |
peer odie 127.0.0.1:10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frontend mysite | |
# the stick table declaration | |
stick-table type ip size 1m expire 1h store http_req_rate(10s) peers mypeers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Data is kept | |
$ sudo systemctl reload haproxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Does not work | |
$ sudo systemctl restart haproxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo "show table mysite" | sudo socat stdio /var/run/haproxy/api.sock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment