On Sat, Jan 16, 2016 at 7:36 AM, Alex <[email protected]> wrote: > Hello, > > I was testing haproxy version 1.6.3 and I am a bit confused regarding > draining a server. > > According to the documentation: > set server <backend>/<server> state [ ready | drain | maint ] > [...] Setting the mode to "drain" only removes the server from load > balancing but still allows it to be checked and to accept new persistent > connections. > > set weight <backend>/<server> <weight>[%] > [...] A typical usage of this command is to disable a server during an > update by setting its weight to zero, then to enable it again after the > update by setting it back to 100%. > > > Well basically setting weight to 0 immediately disables the backend whereas draining stops any new connections going to the backend but the existing sessions are allowed to continue until some time limit is reached, lets say 15 minutes, after which the backend gets completely disabled. It is kinda removing the backend from the load balancer forcefully vs gracefully (allowing the existing sessions to finish). What method to use is really up to you and your user case.
> What I can see from my basic tests is that they behave the same with the > exception that if I set the weight to 0 the corresponding server line from > the stats page becomes blue and if I set state drain the line remains green > and the status changes to DRAIN. > > Can you please tell me which of the above methods is the recommended one > and what are the differences, if any ? > Also, the server line from stats should become blue for status change to > DRAIN, or my test result is the expected behavior ? > > Thank you, > -- > Alex S >

