Configuring mod_backhand is fairly straight forward. If you installed
mod_backhand by "patching" the Apache source tree as is recommended, then
you have a notable advantage over those who did not. The "patching" process
adds the directives into the default httpd.conf file and adds a test cgi-bin
script that should give you a basic feel for how things are working.
Otherwise, you have to know about all the directive that mob_backhand
understands. Here is how it works (what you need for a basic configuration):
Let us set up an environment for this example (ours at CNDS):
We have 10 Intel Linux machines that we wish to place on our cluster.
The network is 128.220.221.0/24 (and ths the broadcast address is
128.220.221.255). The web servers IPs are 128.220.221.21 -> 128.220.221.31
sans 128.220.221.28. We like to install out backhand enable apache server
with the prefix /var/backhand.
LoadModule backhand_module libexec/mod_backhand.so
Add the following line before any other AddModule directive, but after
ClearModuleList:
AddModule mod_backhand.c
OK, now backhand is loaded into the system. Now we need to tell it how to
communicate with child httpd processes and other backhand enabled servers. Add:
<IfModule mod_backhand.c>
# This directorty must be readable and writable by euid of apache (nobody)
# The mod_backhand-Arriba and the AF_UNIX domain files are stored in here.
UnixSocketDir /var/backhand/backhand
# This would be the way to do ethernet broadcast
# MulticastStats 128.220.221.255:4445
# but we choose to use the following IP multicast address with a TTL of 1
MulticastStats 239.255.221.20:4445,1
# We want to accept resource information originating from any IP on our
# network.
AcceptStats 128.220.221.0/24
</IfModule>
OK, now it should be able to share information. We would like to be able to
see what the servers personal view of the world (cluster resources) is at any
given time, so let's enable the diagnostic handler:
<Location "/backhand/">
SetHandler backhand-handler
</Location>
Now, let us enable it for a single directory. The cgi-bin directory on our
servers has some really hefty web applications (that really drive the load up).
We want to have the cgi-bin requests automatically redirected to the server
with the lowest load. Due to the possibility of multiple servers contending
for the same resources, we want to have each server only consider a random
subset of the servers. Of course, we only want server we have heard from
lately. So, inside the <Directory> declaration for your cgi-bin
directory we add our Backhand directives.
<Directory "/var/backhand/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
Backhand byAge
Backhand byRandom
Backhand byLogWindow
Backhand byLoad
</Directory>
Presto! Restart your server and try it out. We have included in the source
distribution a same CGI script (that will tell you where you connected to and
which site you were redirected to.
We have this site up as www.backhand.org.
Visit:
|