It seems like HAProxy doesn't allow this. We have Tomcat servers on the backend and are planning to use Apache + mod_jk to load balance. We're considering switching to something more full-featured like Netscaler but I'm not sold since part of what I'm looking for is the ability to do a seamless deployment where I could remove one of the Tomcat servers from the load balancer before rebooting it.
|
closed as not constructive by Chris S♦ Dec 24 '12 at 6:10
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
HAProxy allows you to do this by passing a command into the stats socket to disable the server. This will drain the connections (existing connections to this server will persist, but no new connections will be made to it). This page gives a good summary of the commands available: http://code.google.com/p/haproxy-docs/wiki/UnixSocketCommands and a disable example:
where /var/run/haproxy.stat is the UNIX domain socket for the commands, which is configured in the haproxy config file like so:
alongside any other global options. Not you don't have to communicate on the socket via socat, you can connect to it like any other UNIX domain socket, which is quite straightforward in Python, Perl, PHP, C, etc. socat is mainly used in examples for convenience. |
|||
|
|
|
Apache can do it if you use |
|||
|
|
|
I use LVS (www.linuxvirtualserver.org), which allows you to change a server's weight or remove it from rotation any time. Very handy when I need to install updates on web servers. |
|||
|
|
|
So long as your application allows user session-state to be served from all of the servers behind the load-balancer, pretty much all load-balancers support this. If your application sessions are sticky to the physical server the user is communicating with, your best bet is to disallow new connections to the server you want to take out of service and wait until the sessions have all closed. Depending on your app, this could be seconds or hours. |
|||
|
|
|
NGINX will allow you to do this, and to do non-fair load balances. upstream Defintion blocks allow you to set various settings about the upstream servers that requests will be sent to.
There is also the proxy_next_upstream setting which allows you to have NGINX automatically try a different backend if one returns an unsatisfactory result. |
|||
|
|
|
An alternative to @James Little's suggestion of socat you could also use hatop to connect to the HAProxy CLI to run the disable (or any of the other commands): hatop -s /var/run/haproxy.statThen hit 5 (listed as 5-CLI in the bottom left menu bar). This will provide you with a prompt where you can enter commands for HAProxy. |
|||
|
|