Apache delete/remove/undefine a proxy balancer definition

292 Views Asked by At

I have an Apache configuration that needs to implement a balancer that uses a set of temporary upstream servers for a few months and then replace them with a permanent set. I am trying to design an approach that lets me deliver both configurations at install time and makes it easy to switch them programmatically later on. This needs to be done on about 40 servers that all have unique configurations.

What I've tried so far...

I added the following code to the httpd.conf file:

<proxy balancer://upstream>
  balancermember http://permanentserver1:80
  balancermember http://permanentserver2:80 status=+H
  balancermember http://permanentserver3:80 status=+H
</proxy>
include conf\temp_upstream.conf

..and then inside the temp_upstream.conf file, I try to overwrite the definition of the balancer

<proxy balancer://upstream>>
  balancermember http://temporaryserver1:80
  balancermember http://temporaryserver2:80 status=+H
  balancermember http://temporaryserver3:80 status=+H
</proxy>

…but it doesn't seem to work. The second balancer definition appears to be ignored (although it may be merged - I can't easily tell).

The reason I'm using this approach is so that I can just replace the temp_upstream.conf file with an empty file when it's time to perform the switch over - and then restart Apache.

Is there any way I can make this configuration work? Is there a way that I can undefine/delete a balancer that was defined earlier in the script so that the second definition is accepted? (I do know that I could pass a variable on the startup line and use IfDefine to conditionally process the right definition - but that would mean modifying the Apache startup command which I'd rather not do.)

1

There are 1 best solutions below

0
On

I recently came upon a perfect solution to my problem.

I confirmed that the 2 definitions are merged in memory to make one larger definition.

I was able to make it work exactly like I wanted it to by adding "lbset=0" (the default) to each BalancerMember definition in the temporary configuration in the temp_upstream.conf file and "lbset=1" to the BalancerMember definitions in the permanent configuration in httpd.conf. The lbset=1 definitions are only used after all lbset=0 definitions have failed.