[lug] Load-balancing web servers

Jeff Schroeder jeff at neobox.net
Fri Jan 10 11:51:11 MST 2003


Hey all!

I've got a pair of identical web servers behind an iptables firewall.  
I'd like to set up load-balancing on the firewall, using iptables, so 
that incoming requests are routed to each server.  (Yes, I know how to 
do the iptables configuration.)

My problem is this: the files on the two web servers must always be 
synchronized for this to work.  I have around 30 clients hosting their 
sites, and if they upload a new index.html file to their home directory 
on server #1, obviously I need it to show up on server #2 so when they 
hit the site with a browser it'll be visible no matter which of the two 
web servers was "selected" by iptables.

Right now, I'm using rsync to re-synchronize the files every 10 minutes.  
One server is a backup, so only the primary is visible at any time.  If 
the primary fails, the backup takes over and no one's the wiser (unless 
they uploaded something in the last 10 minutes).

Is there a way to keep the files synchronized in near-real-time, so the 
load balancing works seamlessly?  I know I could have a third server 
that's, say, NFS-mounted by the two web servers, but then I have a 
single point of failure-- which is the very thing I'm trying to avoid.  
I looked at a package called DRBD a while back; it's a "network RAID" 
system but was beta code and I had some problems with it.  And I don't 
think rsync-ing every 10 seconds is a viable solution, either...

TIA,
Jeff



More information about the LUG mailing list