I've investigated the behavior of mod_proxy_balancer and graceful restarts. I've found out, that nearly every setting regarding load-balancing requires either A) a restart instead of a graceful restart, or B) give the balancer a new id, and then do a graceful restart to take effect.
I'll provide an example. Assume we have a loadbalancer configured like this:
<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>
If we want to change the healthcheck template to "template2", this configuration does not work:
<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>
but instead, if i do exactly the same AND rename the balancer, it will work after a graceful restart:
<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>
As i said this is for almost every loadbalancer related setting the same:
- hcinterval
- hctemplate
- hcuri
- hcexpr
- ProxySet stickysession=
- ProxySet lbmethod=
- ProxyHCTemplate
- ProxyHCExpr
- switching healthchecks on/off
Tested with Apache v. 2.4.33.
Our strategy is now, to include all this settings into a hash, and then use the hash as balancer-id. Like this, whenever one of this settings is changed, the balancer gets a new id and the changes work. Is this a good solution? Has someone found a better workarround/solution for this, or some more insights why the balancer must be renamed? Restarting is no option for us..
i found bug reports that seem to be related to this:
https://bz.apache.org/bugzilla/show_bug.cgi?id=58529
https://bz.apache.org/bugzilla/show_bug.cgi?id=49771
and:
https://bz.apache.org/bugzilla/show_bug.cgi?id=55152
in the last one, it's stated that it is fixed, but still this problem appears in 2.4.33