Chr*_*uet 16 maintenance cookies haproxy
我正在使用 haproxy 对 Web 服务器进行负载平衡。我将会话持久性与附加 cookie 一起使用,因为某些应用程序使用会话文件,而这些文件在服务器之间不同步。
我想禁用服务器进行维护,但不中断会话。所以我想允许现有客户继续他们的应用程序会话,但不接受新客户。
您认为通过某些 haproxy 配置可以实现吗?或者有什么聪明的方法来做到这一点?
满足此需求的其他方法的非详尽列表:
我使用这种配置:
frontend https-in
bind xxx.xxx.xxx.xxx:443 ssl crt /etc/haproxy/ssl/_default.pem crt /etc/haproxy/ssl
reqadd X-Forwarded-Proto:\ https
acl APP1 hdr(host) -i APP1.atac.local
use_backend APP1 if APP1
default_backend _default
backend APP1
redirect scheme https if !{ ssl_fc }
mode http
balance roundrobin
cookie HAPROXY_SESSION insert indirect
option httpchk HEAD /haproxy_test_page.php HTTP/1.0\nUser-Agent:\ HAProxy
server SRV1 SRV1_IP:PORT cookie SRV1 check
server SRV2 SRV2_IP:PORT cookie SRV2 check
Run Code Online (Sandbox Code Playgroud)
如果我只是禁用 SRV1(使用 haproxy cli 命令),我认为在 SRV1 上打开的所有应用程序会话都会在当前 HTTP“会话”结束后中断。那正确吗?
使用 Web 管理界面将服务器置于排放模式。这提供了您正在寻找的确切功能。
Web 管理界面的详细信息 - https://github.com/Aidaho12/haproxy-wi