I'm using keepalived to load-balance connections between a number of TCP servers. I don't expect it matters, but the service in this case is rabbitmq. I'm using NAT type balancing with weighted round-robin.
A client connects to the server thus:
[client]-----------[lvs]------------[real server]
a b
If a client connects to the LVS and remains idle, sending nothing on the socket, this eventually times out, according to timeouts set using ipvsadm --set
. At this point, the connection marked 'a' above correctly disappears from the output of netstat -anp
on the client, and from the output of ipvsadm -L -n -c
on the lvs box. Connection 'b', however, remains ESTABLISHED according to netstat -anp
on the real server box.
Why is this? Can I force lvs to properly reset the connection to the real server?
Do you have persistent connection enabled? The persistent connection timeout can be set using -p [timeout]
This keeps connection b active to route further requests from the client IP to the same real server.
You can use the --set command to decrease the timeout.
Or give haproxy a try.
I had the same problem. I stopped firewalld, and solved it.
in LVS MASTER, I use tcpdump and found that the LVS do not forward the F packet to RS, and client send F package to LVS again and again
add -e to tcpdump to see the MAC of machine:
tcpdump -i eth0 -nn -e host CLIENT_IP and port 80
10.220.16.105 is the client ip, and 10.220.15.10 is VIP
finally, i try systemctl stop firewalld.