How to: Simple load balancer setup for web servers

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:


#first web server
Port 80

#second web server
Port 80


 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 (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.


New server

Bought some stuff from the Canonical store recently, supposedly it'll take anywhere from 2 to 12 weeks. Awesome.

I took down all my local servers and building one larger one. For the last 8 hours or so, I've been trying to get it to work but no luck. Alright, check this out: Install Debian on HDD. Try to boot => instant restart. Back to the BIOS.
Like WTF?



Web, log and mail server.

Thought I'd take it upon myself to create a mail server on 'roppie' (me server). It's now a log server also, I even got my router to send logs to it too. Interesting it is though, I have 'jlap' sending all its logs to roppie too. 'roppie' also runs a minimal web server (lighttpd + mysql, same as jlap) but also serves the logs out on HTTP so I can view them anywhere.

  I've been using SFTP on roppie since FTP didn't work for a loooong time. I tried to FTP to it today...and well....proftpd wasn't installed in the first place. So now I have that up and running so its all good.

  A switch would be nice for my network, something under 100$ (which I found one on Staples) and it would probably increase my network performace :D
  According to my router, I'm only getting 10Mbps half duplex from my modem/ISP. Which sucks.

Overall, I'm pretty happy with myself for what I did. I set up two servers, tweaked them and....are actually...running smoothly.