On Tue, Mar 29, 2016 at 7:21 PM, Paul Draper <[email protected]> wrote: > As I understand it, there seems to no way to add a server to HAProxy without > incurring significant disruption. Adding a server requires reloading > configuration. This loses all statistics, all health check information, etc. > So, for instance, after adding a server, HAProxy will send traffic to > unhealthy servers. > > I add and remove servers frequently: > * HAProxy doesn't respect DNS TTLs, so I reresolve on a regular basis, and > update the config. (For example, s3-1.amazon.com has 4s TTL.) > * I scale the number of backend servers to match traffic patterns. Scaling > actions happen at least several times a day. > > This is a frequently asked question about HAProxy, and reloading the > configuration seems a disruptive solution > (http://serverfault.com/questions/165883/is-there-a-way-to-add-more-backend-server-to-haproxy-without-restarting-haproxy#comment181125_165885). > > I'm willing to make non-HAProxy changes in my system, e.g. with iptables, > though I haven't conceived a way that anything else would solve the problem. > > Andreas Kohn attempted to allow adding and removing via the stats socket in > 2010: http://marc.info/?t=129189972500003&r=1&w=2 > > What's the feasibility of adding and removing servers dynamically? Is there > a better way to achieve these goals? Should I look into an HAProxy patch, or > would I be wasting my time?
Hi Paul, Your understanding of the reload problem is right. That said, as Chris explained you, there is now, in 1.6, a couple of features which may help: 1. you can perform DNS resolution at run time (from my understanding, you don't do it now) 2. you can save and apply server states (not the statistics) before and after reloads, to avoid the unhealthy server effect There is one last thing you may want to do is to configure a server IP address using the stats socket. So it may allow you to pre-populate a farm with many servers, pointing to a dummy IP and then, once your VM has started, you can change a server IP address in the configuration to point to it. I know, this is not an ideal situation and we're well aware of it. We're working on a few things to address the type of requirements you have. One of them would be to integrate (or rewrite) the "initial-state" patch proposed by Chris, and some of them would to allow "dynamic" addition of server in the farm at run time using the stats socket. This may be possible, but may not be compatible with all type of load-balancing algorithm and features. Stay tuned :) Baptiste

