Apache load balancer, failover & backup

apache-2.2backupfailover

I did a load balanced with apache and the mod_proxy. Everything work well and I can load balance between two servers.
Now I would like to do more.
First I would like to do failover (if a server down, all the charge go to the other one)> Does it work only with this: nofailover=On ?
Then I would like to have a second load balancer as a backup if the first one down. I search on internet but I didn't find.
Do you know if it's possible to do it?
To finish, Does it possible to change the configuration (like the ip of the server) in the load balancer without restart it because it's running?

Thanks for your answer

Best Answer

To set a BalancerMember as a hot spare, so that it will only get requests if no other upstream is available, use status=+H:

<Proxy balancer://failovercluster>
    BalancerMember http://10.1.1.4
    BalancerMember http://10.1.1.5 status=+H
</Proxy>

(one caveat is that some older versions of apache had a bug where +H didn't work)


One common method to set up a second load balancer would be to just set up a second system with identical configuration, and use DNS round robin to let users hit whichever one they happen to hit. Of course, this can incur delays for clients if one of the load balancers goes down; not a good thing.

Another option is to use VRRPd. I won't go into the implementation specifics here, but it would have your two load balancers sharing a single virtual IP address, which would move to the other device if one of them becomes unreachable.


Using "reload" (/etc/init.d/apache2 reload) will do a graceful restart of the apache service; this avoids dropping connections.