How to add/delete Apache2 balancer-members without restart

2.4k views Asked by At

I want to know, if there is a way to add/delete Apache2 mod_proxy_balancer balancer-members without doing a full restart of apache, so that the existing connections dont't get interrupted?

if i just update the members in the equal vhost-file and do a soft-restart via

service apache2 reload

apache wont apply the changes made. The provided balancer-manager directive and web backend allows to modify the parameters of the particular blanacer-member (e.g. loadfactor) without an restart, but its not possible to add new or delete existing members in this way.

1

There are 1 answers

1
chris On BEST ANSWER

finally, due to some infrequent problems regarding apache and mod_proxy_balancer (see https://issues.apache.org/bugzilla/show_bug.cgi?id=44736 for more details) i did a little workaround:

first of all filling up the balancer worker configuration with placeholders an setting loadfactor to "1", e.g.:

<Proxy balancer://mycluster>
   BalancerMember http://www.cmgm.info/virtual/1/  loadfactor=1
   BalancerMember http://www.cmgm.info/virtual/2/  loadfactor=1
   BalancerMember http://www.cmgm.info/virtual/3/  loadfactor=1
   BalancerMember http://www.cmgm.info/virtual/4/  loadfactor=1
   BalancerMember http://www.cmgm.info/virtual/5/  loadfactor=1
   ...
   BalancerMember http://www.cmgm.info/virtual/n/  loadfactor=1
</Proxy>

then mod_rewrite is used to dynamically assign the placeholders to real balancer memebers, e.g.:

RewriteEngine on
RewriteRule ^1/(.*)$ http://www.worker1.de/$1 [P]
RewriteRule ^2/(.*)$ http://www.worker2.de/$1 [P]
...
RewriteRule ^n/(.*)$ http://www.workern.de/$1 [P]

adding, deleteing, enabling, disabling and setting the loadfactor of each (virtual) member is done by accessing the balancer-manager webinterface.

to sum up, mod_proxy_balancer can be dynamicall modified programmatically using this workaround.