大网数据广告活动
服务器运维问答

Haproxy 1.8 : Drain or Set Weight 0 - Layer 4 & layer 7

· 52CE 我爱测

We have deployed multiple Haproxys TCP mode haproxy for the DB front and layer 7 haproxy for app front in production. I am looking for which is the best option to take one backend node out of traffic and do update/release/mainten…

问题原文

原帖链接 · SAGAR Nair · CC BY-SA 4.0

We have deployed multiple Haproxys TCP mode haproxy for the DB front and layer 7 haproxy for app front in production. I am looking for which is the best option to take one backend node out of traffic and do update/release/maintenance on applications. either I use Set server state Drain or set weight 0 which one will be effective and useful to slowly redirect all the clients connection to the other backends for app with out breaking and redirect all tcp connections as well ? also let me know whats meant by persistent connections ?

已采纳解答

原帖链接 · wurtel · CC BY-SA 4.0

Use Drain.

That prevents new sessions being directed to the backend in question, however existing sessions will still be directed to that backend. Hence you should wait a reasonable amount of time for users to end their session (depending on the type of workload this could be a couple of minutes up to a day).

This of course is assuming that you have sticky sessions configured in haproxy, so that a user will always be directed to the same backend. If this is not the case, then it makes no difference if you use weight 0 or drain.

Persistent connections are connections that stay open. If you want to use those, then ensure that haproxy timeouts are long enough to cater to those connections; otherwise haproxy may close a connection that is still in use (but idle).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-04-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。