首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >LVS连接超时-挥之不去的连接

LVS连接超时-挥之不去的连接
EN

Server Fault用户
提问于 2009-08-10 14:51:50
回答 3查看 4.4K关注 0票数 2

我使用“保持”在多个TCP服务器之间的负载平衡连接。我不认为这有什么关系,但这种情况下的服务是rabbitmq。我用的是NAT型平衡和加权循环。

因此,客户端连接到服务器:

代码语言:javascript
运行
复制
[client]-----------[lvs]------------[real server]
            a                b

如果客户端连接到LVS并保持空闲,而没有在套接字上发送任何内容,那么根据使用ipvsadm --set设置的超时,这最终会超时。此时,上面标记为'a‘的连接将正确地从客户机上的netstat -anp输出和lvs框上的ipvsadm -L -n -c输出中消失。但是,连接'b‘仍然是根据真实服务器框上的netstat -anp建立的。

为什么会这样呢?我可以强制lvs正确地重置到真正服务器的连接吗?

EN

回答 3

Server Fault用户

发布于 2009-08-13 12:19:07

是否启用了持久连接?可以使用-p 超时设置持久连接超时。

这使连接b保持活动状态,以便将进一步的请求从客户机IP路由到同一个实际服务器。

票数 1
EN

Server Fault用户

发布于 2011-04-20 06:59:05

您可以使用--set命令来减少超时.

代码语言:javascript
运行
复制
/sbin/ipvsadm --set 3600 120 300

或者让哈代试试。

票数 1
EN

Server Fault用户

发布于 2021-06-17 13:24:42

我也有同样的问题。我阻止了火并解决了它。

在LVS主服务器中,我使用tcpdump,发现LVS不将F包转发给RS,客户端一次又一次地向LVS发送F包

将-e添加到tcpdump以查看机器的MAC:

tcpdump -i eth0 -nn -e host CLIENT_IP and port 80

10.220.16.105是客户ip,10.220.15.10是VIP

代码语言:javascript
运行
复制
[root@lvs-1 ~]# tcpdump -i eth0 -nn    -e host 10.220.16.105 and port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:54:31.100494 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 74: 10.220.16.105.50290 > 10.220.15.10.80: Flags [S], seq 2199151220, win 29200, options [mss 1460,nop,nop,TS val 3042809285 ecr 0,nop,wscale 7], length 0
20:54:31.100583 fe:fc:fe:ec:9f:61 > fe:fc:fe:e2:15:d6, ethertype IPv4 (0x0800), length 74: 10.220.16.105.50290 > 10.220.15.10.80: Flags [S], seq 2199151220, win 29200, options [mss 1460,nop,nop,TS val 3042809285 ecr 0,nop,wscale 7], length 0
20:54:31.101908 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 3272581466, win 229, options [nop,nop,TS val 3042809285 ecr 101900523], length 0
20:54:31.101940 fe:fc:fe:ec:9f:61 > fe:fc:fe:e2:15:d6, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 3042809285 ecr 101900523], length 0
20:54:31.104153 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 142: 10.220.16.105.50290 > 10.220.15.10.80: Flags [P.], seq 0:76, ack 1, win 229, options [nop,nop,TS val 3042809288 ecr 101900523], length 76: HTTP: GET / HTTP/1.1
20:54:31.104183 fe:fc:fe:ec:9f:61 > fe:fc:fe:e2:15:d6, ethertype IPv4 (0x0800), length 142: 10.220.16.105.50290 > 10.220.15.10.80: Flags [P.], seq 0:76, ack 1, win 229, options [nop,nop,TS val 3042809288 ecr 101900523], length 76: HTTP: GET / HTTP/1.1
20:54:31.104935 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 263, win 237, options [nop,nop,TS val 3042809289 ecr 101900527], length 0
20:54:31.104960 fe:fc:fe:ec:9f:61 > fe:fc:fe:e2:15:d6, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 263, win 237, options [nop,nop,TS val 3042809289 ecr 101900527], length 0
20:54:31.105523 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 280, win 237, options [nop,nop,TS val 3042809290 ecr 101900527], length 0
20:54:31.105547 fe:fc:fe:ec:9f:61 > fe:fc:fe:e2:15:d6, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [.], ack 280, win 237, options [nop,nop,TS val 3042809290 ecr 101900527], length 0
20:54:31.106257 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042809290 ecr 101900527], length 0
20:54:31.306408 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042809491 ecr 101900527], length 0
20:54:31.711239 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042809895 ecr 101900527], length 0
20:54:32.515396 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042810700 ecr 101900527], length 0
20:54:34.130929 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042812312 ecr 101900527], length 0
20:54:37.352335 fe:fc:fe:bf:47:9b > fe:fc:fe:ec:9f:61, ethertype IPv4 (0x0800), length 66: 10.220.16.105.50290 > 10.220.15.10.80: Flags [F.], seq 76, ack 280, win 237, options [nop,nop,TS val 3042815536 ecr 101900527], length 0

最后,我尝试系统停止火灾。

票数 -1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/52300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档