commit f7d403804ea0ef561d88b22b1d589f9aefddd615 parent 962d9141a5c004cad495a95e79278155f61393c4 Author: MTRNord <mtrnord1@gmail.com> Date: Thu, 31 Aug 2023 22:01:12 +0200 Try using virtual servers in keepalived Diffstat:
| M | nixos/worker-1/configuration.nix | | | 38 | +++++++++++++++++++++++++++++++++++++- |
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/nixos/worker-1/configuration.nix b/nixos/worker-1/configuration.nix @@ -606,6 +606,42 @@ extraGlobalDefs = '' router_id uMASTER ''; + extraConfig = '' + # Virtual Servers definitions + virtual_server 10.100.12.1 5000 { + delay_loop 30 + + lb_algo wrr + lb_kind NAT + + persistence_timeout 50 + protocol TCP + real_server 100.64.0.3 5432 { + weight 2 + HTTP_GET { + url { + path / + } + + connect_timeout 3 + retry 3 + delay_before_retry 2 + } + } + real_server 100.64.0.1 5432 { + weight 2 + HTTP_GET { + url { + path / + } + + connect_timeout 3 + retry 3 + delay_before_retry 2 + } + } + } + ''; vrrpInstances = { VI_1 = { state = "BACKUP"; @@ -964,7 +1000,7 @@ listen postgres bind 100.64.0.1:5000 bind 127.0.0.1:5000 - bind 10.100.12.1:5000 + #bind 10.100.12.1:5000 mode tcp option httpchk http-check expect status 200