Force re-balance of long living connections

Hi,

I’m very new to HA Proxy and i love it. But now i ran into a problem i could not find an answer for yet.

I’m testing a three node Graylog installation where HA Proxy is doing the balancing of https requests and Syslog messages. The connections of the Syslog servers are long living sessions and therefore i set it to “balance leastconn”. That’s fine so far. But if i have f.ex. to shutdown one of the servers for maintenance and bring it back online later, it of course doesn’t get any connections as long there is no interruption of a connections to the other nodes or a Syslog client restarts f.ex.

Long story short: Is there i way i can force it to re-balance the connections to all nodes out of the box? F.ex. reset some connections to the other nodes if there is a heavy imbalance so that they are re-established and connect to the node which just came back online to keep the number of connections balanced over all nodes.

Could be that it’s already doing something like that. I have only two Syslog clients for testing at the moment.

Thank you,
Urs

You can shutdown sessions on the admin socket:

http://cbonte.github.io/haproxy-dconv/1.6/management.html#9.2-shutdown%20session

Hi Lukas,

Never saw this part of the documentation before, until now… Had a quick look into it and it seems to provide exactly what i need. Thanks.

I think i will write a script to parse the session data and count which backend has how many connections every X minutes and then randomly shutdown some sessions of the hosts with more connections to rebalance it if it’s heavily imbalanced.

Thank you,
Urs