I finally put together a load balancing setup together this weekend, and I'm surprised it was this easy.
What you'll need is three servers, two web servers and one server for the load balancer. It's not recommended that you only use one load balancer since it's a single point of failure (SPOF) but I only had one extra server on hand. For this tutorial, I used Debian Lenny.
First thing's first, download and install pound on your load balancer.
apt-get install pound
Once you've done that, head over to /etc/pound and edit your pound.cfg file accordingly. Here's an example for the web servers:
Service #first web server BackEnd Address 192.168.0.114 Port 80 End #second web server BackEnd Address 192.168.0.116 Port 80 End End End
Also be sure to set your ListenHTTP address and port.
Now edit your /etc/default/pound file and change startup=0 to startup=1
Start pound up with /etc/init.d/pound start If everything is configured properly, check out http://22.214.171.124:8080 (or whatever IP and port you put in your pound.cfg)
Half the time, the requests should go to Server A while the other half goes to Server B (you can configure this). For anything else, check out the man page here or type man pound.
Luckily, my file server is running NFS and SAMBA, so I can have the same content on each web server. I couldn't completely get NFS working on Windows Server 2008 (which is on one of the web servers, ugh) so I mapped a SAMBA shared as a network drive and that seemed to work.
That's the end of this short tutorial, but keep in mind there's more things you can do with pound. You can set up chroot jails, HTTPS balancing and way more. Any comments or ideas are appreciated.