【发布时间】:2018-07-16 10:51:55
【问题描述】:
我已经调查了 mod_proxy_balancer 和优雅重启的行为。我发现,几乎所有关于负载平衡的设置都需要 A)重新启动而不是正常重新启动,或 B)给平衡器一个新的id,然后优雅地重启 生效。
我将提供一个示例。假设我们有一个这样配置的负载均衡器:
<VirtualHost 22.11.22.11:443>
ServerName Hostname
ProxyHCExpr isok {hc('body') =~ /==welcome ok1==/}
ProxyHCTemplate template1 hcinterval=1 hcexpr=isok hcmethod=get hcuri=/healthcheck.php
ProxyHCTemplate template2 hcinterval=1 hcexpr=isok hcmethod=head hcuri=/head_check.php
<Proxy balancer:mybalancer>
BalancerMember https://www.backend1.com:443 hctemplate=template1
BalancerMember https://www.backend1.com:443 hctemplate=template1
</Proxy>
<VirtualHost>
如果我们想把healthcheck模板改成“template2”,这个配置不起作用:
<VirtualHost 22.11.22.11:443>
ServerName Hostname
ProxyHCExpr isok {hc('body') =~ /==welcome ok1==/}
ProxyHCTemplate template1 hcinterval=1 hcexpr=isok hcmethod=get hcuri=/healthcheck.php
ProxyHCTemplate template2 hcinterval=1 hcexpr=isok hcmethod=head hcuri=/head_check.php
<Proxy balancer:mybalancer>
BalancerMember https://www.backend1.com:443 hctemplate=template2
BalancerMember https://www.backend1.com:443 hctemplate=template2
</Proxy>
<VirtualHost>
但是,如果我执行完全相同的操作并重命名平衡器,它将在正常重启后工作:
<VirtualHost 22.11.22.11:443>
ServerName Hostname
ProxyHCExpr isok {hc('body') =~ /==welcome ok1==/}
ProxyHCTemplate template1 hcinterval=1 hcexpr=isok hcmethod=get hcuri=/healthcheck.php
ProxyHCTemplate template2 hcinterval=1 hcexpr=isok hcmethod=head hcuri=/head_check.php
<Proxy balancer:myNEWbalancer>
BalancerMember https://www.backend1.com:443 hctemplate=template2
BalancerMember https://www.backend1.com:443 hctemplate=template2
</Proxy>
<VirtualHost>
正如我所说,这几乎适用于每个负载均衡器相关设置:
- hcinterval
- hc模板
- hcuri
- hcepr
- ProxySet stickysession=
- ProxySet lbmethod=
- 代理HC模板
- ProxyHCExpr
- 打开/关闭运行状况检查
使用 Apache v. 2.4.33 测试。
我们现在的策略是,将所有这些设置包含在一个哈希中,然后使用该哈希作为 balancer-id。像这样,每当更改其中一个设置时,平衡器都会获得一个新的 id 并且更改会起作用。 这是一个好的解决方案吗?是否有人为此找到了更好的解决方法/解决方案,或者更多的见解为什么必须重命名平衡器?重启对我们来说是没有选择的..
我发现了似乎与此相关的错误报告:
https://bz.apache.org/bugzilla/show_bug.cgi?id=58529
https://bz.apache.org/bugzilla/show_bug.cgi?id=49771
和:
https://bz.apache.org/bugzilla/show_bug.cgi?id=55152
上一篇说已经修复了,但是2.4.33还是出现这个问题
【问题讨论】:
标签: apache load-balancing httpd.conf mod-proxy mod-proxy-balancer