-
-
Save haproxytechblog/6e8f7f5b08f2f7bf9c2d8e6fa9e6e715 to your computer and use it in GitHub Desktop.
Announcing HAProxy 2.7
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 | |
bind 0.0.0.0:10000 | |
shards 2 | |
server lb1 | |
server peer1 192.168.56.40:10000 shard 1 | |
server peer2 192.168.56.41:10000 shard 2 | |
table rates type binary len 20 size 100k expire 10s store http_req_rate(10s) |
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
-- script arguments are put into variable 'args' | |
local args = table.pack(...) | |
local arg1 = args[1] -- returns 'hello' | |
local arg2 = args[2] -- returns 123 | |
-- this function prints the arguments when | |
-- 'http-request lua.log-args' is called | |
local function log_args(txn) | |
core.Info(arg1) | |
core.Info(arg2) | |
end | |
core.register_action("log-args", {"http-req"}, log_args, 0) |
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 | |
lua-load /path/to/script.lua "hello" 123 |
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 | |
bind :80 | |
default_backend servers | |
# call the action | |
http-request lua.log-args |
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 "reload" | sudo socat -t300 /run/haproxy-master.sock - | |
Success=1 | |
-- | |
[NOTICE] (2495) : New worker (2546) forked | |
[NOTICE] (2495) : Loading success. | |
[NOTICE] (2495) : haproxy version is 2.7 | |
[NOTICE] (2495) : path to executable is /usr/sbin/haproxy | |
[WARNING] (2495) : Former worker (2538) exited with code 0 (Exit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment