This is simply one of many different configurations of a ModBackhand cluster and is how I currently have mine setup.
In this configuration we have a single machine at the front that has a stripped down version of Apache that will do all the load balancing and not service requests itself. Behind the balancer is the cluster of application servers, these will have the heavier Apache (ie, PHP, mod_perl, mod_jk/Tomcat) and do all the actual serving of requests.
In this example though we have a single point of failure, which is the balancer, this can be fixed by having a second backup balancer ready to take over (see HighAvailability).
(Note: mod_backhand will only work on Unix machines with Apache 1.3.x)
If you are using apache one you can apt-get install libapache_mod_backhand, unfortunately mod_backhand does not seem to be packaged for Apache2 in sarge.
After it's compiled/installed you need to make sure it's enabled in Apache, check the following lines appear somewhere in your httpd.conf
Make sure /var/backhand exists and is writeable by the user Apache runs as
MulticastStats? 10.58.4.1 220.127.116.11:4445,1
This line tells ModBackhand we want to advertise ourselves as 10.58.4.1 to the multicast address 18.104.22.168 port 4445 with a timeout of 1 second
Because all ModBackhand enabled servers will broadcast information we want to know which information we should listen to, so accept messages from our backend servers on the network 10.58.4.0/24
Having a <Directory> block will enable ModBackhand balancing for all requests to files in that directory, it doesn't have to be your DocumentRoot? and it can also be a <Files .php|.asp> or <Location> block. You can practically balance anything Apache will understand.
Options None Order allow,deny Allow from all
Because this server is simply a balancer we don't want to consider ourself as a valid server when selecting a candidate
We don't want to send a request to a server we haven't heard from in 6 seconds. This provies some fault tolerance as the request won't be directed to a dead candidate.
Randomly choose a server from remaining pool.
This does something I don't quite understand yet, but it's good to have
Decide which candidate is best from the load on that server
If your balancer is serving multiple sites, put the above in a <VirtualHost?> block, otherwise it doesn't matter. These are not the only candidancy functions available, for a list of the rest see the ModBackhand website.
First we enable ModBackhand
Again, make sure /var/backhand exists and is writeable by the Apache user. These options can also go in a <VirtualHost?> block or not. However! Because ModBackhand is proxying these requests you CANNOT use NameBased? Virtual Hosting on sites that are part of the cluster. You CAN use IP Based Virtual Hosting which means you would need a block (like above) for each !VirtualHost? with a different adress for !MulticastStats?. Don't forget to make sure your !DocumentRoot? is right for this !VirtualHost? or the general configuration.
The cluster should be working! If you want to see the status of your cluster, put the following in your balancers httpd.conf
Then browse to http://10.58.4.1/backhand/ and it'll give you a status map.
lib/main.php:944: Notice: PageInfo: Cannot find action page