Dnia 2009-12-24, czw o godzinie 06:29 +0100, Willy Tarreau pisze: > On Wed, Dec 23, 2009 at 02:43:04PM -0800, Paul Hirose wrote: > > I was asked how to get haproxy to reload its configuration file, and not > > disturb any existing connections. For example, if I have two servers > > listed, and I want to take one out for maintenance. > > > > I wasn't sure about the difference between -sf and -st, but from reading > > 2.4(.1), I'm guessing -sf is the better way. It allows all existing > > connections to finish, then temporarily stops/pauses all services(?), > > rereads the configuration file, then restarts again? > > No it does not work like that. > > You start a new process (with -sf or -st). If reads the config and tries > to bind as many services as it can. If some ports are busy, it then sends > a signal to the old process asking it to temporarily release its ports so > that the new one can bind them. This leaves a small window of a few > milliseconds > between the instant the port is unbound and it is rebound, where the port > is not bound at all. But apparently people have absolutely no problem with > that. Then, once the new process is ready, it sends one signal to the old > one indicating to it that it can either finish what it's doing (-sf) or > immediately stop (-st). So upon every restart, you have a fresh new process. > Some people even use that to upgrade the binary without service disruption. There is also little iptables hack, if u wanna be 100% sure no client will get rejected when you're restarting, block sending TCP RST packets to client, so when TCP SYN hits loadbalancer when its restarting and frontend port is closed, client connection won't get resetted, TCP will just retransmit SYN packet.
-- Mariusz Gronczewski (XANi) <[email protected]> GnuPG: 0xEA8ACE64 http://devrandom.pl
signature.asc
Description: To jest część wiadomości podpisana cyfrowo

