Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.

share|improve this answer
    
Persistence has nothing to do with timeouts. The persistence control is for how it handles multiple connections from the same ip, and so that it send them all to the same real server. –  Patrick Feb 4 '11 at 1:36
    
Oh OK, thanks for clarifying. –  Nathan Friend Feb 9 '11 at 15:43
add comment

You can use the --set command to decrease the timeout.

/sbin/ipvsadm --set 3600 120 300

Or give haproxy a try.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.