我在tcp-connections上有一个HAProxy平衡负载。出于某种原因,似乎棍棒表偶尔会失败。以下是我日志中的几行,我们可以看到从单个ip连接到两个后端。连接是在完全相同的时间戳下进行的,可能是棒表不是线程安全的吗? 由于某种原因,过期时间仅为10秒,我们软件中的tcp连接非常粘,因此我们需要很短的过期时间来进行可能的服务器维护过程。
知道这有可能吗?为什么两个同时连接被路由到不同的后端?我们的软件无法处理这种情况,WCF用于通信。
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:12872 [11/Apr/2017:14:05:21.608] https_frontend https_backend/srv1
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:12872 [11/Apr/2017:14:05:21.608] https_frontend https_backend/srv1
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:3342 [11/Apr/2017:14:05:21.608] https_frontend https_backend/srv2
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:3342 [11/Apr/2017:14:05:21.608] https_frontend https_backend/srv2
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:22543 [11/Apr/2017:14:05:34.994] https_frontend https_backend/srv2
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:22543 [11/Apr/2017:14:05:34.994] https_frontend https_backend/srv2
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:26566 [11/Apr/2017:14:05:34.995] https_frontend https_backend/srv2
Apr 11 14:06:07 accuna haproxy[22129]: xx.xx.133.145:26566 [11/Apr/2017:14:05:34.995] https_frontend https_backend/srv2
HAproxy设置:
backend https_backend
mode tcp
option tcplog
balance leastconn
stick-table type ip size 200k expire 10s store conn_cur
tcp-request content track-sc0 src
stick on src
server srv1 10.1.4.210:443 check
server srv2 10.1.5.38:443 check