From ba41368469c04b7bafde334092ae54e43a593837 Mon Sep 17 00:00:00 2001 From: Petu Eusebiu Date: Fri, 18 Mar 2022 16:07:15 +0200 Subject: [PATCH] Modified shared storage haproxy config to stick only writes, not reads Signed-off-by: Petu Eusebiu --- examples/cluster/haproxy.cfg | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/cluster/haproxy.cfg b/examples/cluster/haproxy.cfg index a9ec3c2a..ac1d1048 100644 --- a/examples/cluster/haproxy.cfg +++ b/examples/cluster/haproxy.cfg @@ -34,16 +34,25 @@ defaults errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http -frontend local_zot - bind 127.0.0.1:8080 +frontend zot + bind *:8080 mode http - default_backend my_zots + acl write_methods method POST PATCH DELETE PUT + use_backend zot-stick-writes if write_methods + default_backend zot-reads -backend my_zots +backend zot-stick-writes mode http balance leastconn - stick-table type ip size 1m expire 1h + stick-table type ip size 1m expire 30m stick on src server zot1 127.0.0.1:8081 check - server zot2 127.0.0.1:8081 check - server zot3 127.0.0.1:8082 check + server zot2 127.0.0.1:8082 check + server zot3 127.0.0.1:8083 check + +backend zot-reads + mode http + balance roundrobin + server zot1 127.0.0.1:8081 check + server zot2 127.0.0.1:8082 check + server zot3 127.0.0.1:8083 check