Hi, On Mon, Jan 16, 2012 at 06:40:28PM +0100, Florian Munz wrote: > Hi, > > I'm trying to setup HAProxy to load balance RabbitMQ connections in TCP > mode and I'm not sure I understand how the clients are supposed to > handle a failure. > > In the event one of the two RabbitMQ servers goes down, the clients are > still connected to HAProxy. Do they need to reconnect? Will the TCP > connection get closed by HAProxy?
There are several possibilities. By default, when a server goes down, haproxy does not affect established connections. If the server is cleanly shut down, it will close its connections to haproxy and haproxy will forward the close to the clients. But if the server's power plug is suddenly pulled from the wall, only the timeouts will get rid of the remaining connections. In haproxy 1.5, there's a new server option : "on-marked-down shutdown-sessions" It tells haproxy that in the event where it detects a server failure during a check, it must kill all the connections that were assigned to it. It's particularly well suited to long-running TCP connections such as SQL, LDAP, TSE, ... so I think this is precisely what you'd need. And yes, your clients will have to reconnect anyway since you don't know the connection state when the server died. Regards, Willy

