How to Configure TCP Keep alive timeout in HAProxy


#1

Hi,

Can someone tell me how to configure TCP keepalive timeout in HAProxy.

The request from HAProxy to my server hangs. So I need to timeout the TCP session. I have configured below parameters in my HAProxy. But it fails to timeout within 30s or 1 miniute. It takes very long to get timeout.

So please let me know how to configure TCP keepalivce
timeout in HAProxy.
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout tunnel 30s
timeout client 30s
timeout server 10s

Thanks.
Sudharsan.


#2

You need to provide a more complete configuration, the haproxy release you are using and a more thorough description of the problem.

Is this http mode? If yes, what keep-alive mode? Is it just tcp mode? Are you sure the is not traffic on those supposedly “hang” sessions? What is the protocol?


#3

For example you may refer following configuration:
global
log 127.0.0.1 local3
maxconn 4096
user haproxy
group haproxy
daemon
debug

listen messagebroker_balancer 172.19.19.91:5672
mode tcp
log global
retries 3
timeout connect 5000ms
option redispatch
timeout client 200000ms
timeout server 200000ms
option tcplog
option clitcpka
balance leastconn
server s1 172.19.19.79:5672 check inter 5s rise 2 fall 3
server s2 172.19.19.80:5672 check inter 5s rise 2 fall 3