I’m trying to use HAProxy as a failover TCP solution in case our primary server goes down.
However it simply does not seem to work.
haproxy.cfg
frontend haproxy_sync
bind *:8090
mode tcp
option tcplog
default_backend sync
backend sync
mode tcp
option tcplog
balance roundrobin
server server1 sync1:8090 check on-marked-down shutdown-sessions on-marked-up shutdown-backup-sessions
server server2 sync2:8090 check backup
HAProxy is able to see both servers and connect to the open port
root@scw-haproxy:~# nc -vz sync1 8090
sync1 [hidden] 8090 (?) open
root@scw-haproxy:~# nc -vz sync2 8090
sync2 [hidden] 8090 (?) open
When I test the configuration by shutting down sync1 haproxy log shows:
May 2 13:22:54 scw-haproxy haproxy[8985]: Server sync/server1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 81ms. 0 active and 1 backup servers left. Running on backup. 0 sessions active, 0 requeued, 0 remaining in queue.
May 2 13:22:54 scw-haproxy haproxy[8985]: Server sync/server1 is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 81ms. 0 active and 1 backup servers left. Running on backup. 0 sessions active, 0 requeued, 0 remaining in queue.
But no traffic ends up going through to server2/sync2 (backup server)
Any idea what I have configured incorrectly here?
I am using HA-Proxy version 1.6.3