Hi All,
I am trying to come up with a configuration that a backup server become
active as soon as a server in active pool goes down.
For doing that I interleaved the active and backup pool and used ACL to
switch to backends based on number of servers in active pool.
The issue that I am facing is that when context switch happens the
common server connection count gets reset and it goes over maxconn.
As in the following configuration if srv2 goes down, while each srv1 and
srv2 has 80 connections, the backup_pool becomes active.
Now however srv1 is still maintaining its 80 connections, if I push
another 50 connections the srv1 will reach 105 and srv3 will have 25.
I was wondering if there is any way to keep the connection counter
between backends to handle this case with scenario?
Or is there any other way I can configure haproxy for this scenario?
If any code changes that required, I am willing to contribute if this is
a valid case.
Regards,
Rama
here is the my config file:
I am using haproxy 1.4.21
======================================================
global
log /var/run/log local1 debug
maxconn 1024
debug
#quiet
defaults
log global
mode tcp
option tcplog
option logasap
timeout server 5000
timeout client 5000
timeout connect 5000
frontend proto_in
bind *:1935
acl SRV_DOWN nbsrv(active_pool) lt 2
default_backend active_pool
use_backend backup_pool if SRV_DOWN
backend active_pool
mode tcp
balance leastconn
timeout server 5000
timeout connect 5000
option log-health-checks
option httpchk OPTIONS * HTTP/1.1\r\nHost:\
server srv1.foo.com 10.10.10.75:1935 check port 8086 maxconn 100
server srv2.foo.com 10.10.10.29:1935 check port 8086 maxconn 100
backend backup_pool
mode tcp
balance leastconn
timeout server 5000
timeout connect 5000
option log-health-checks
option httpchk OPTIONS * HTTP/1.1\r\nHost:\
server srv1.foo.com 10.10.10.75:1935 check port 8086 maxconn 100
server srv2.foo.com 10.10.10.29:1935 check port 8086 maxconn 100
#including backup
server srv3.foo.com 10.10.10.28:1935 check port 8086 maxconn 100
======================================================