[ENBD] Mirroring Two Sites

Peter T. Breuer enbd@lists.community.tummy.com
Thu, 7 Mar 2002 16:33:55 +0100 (MET)


"A month of sundays ago Martin Kuria wrote:"
> I have a website which I have hosted on a Linux 7.2 machine using Apache 
> Webserver,
> 
> am using rsync to mirror this website to another machine actually I am using 
> rsync to backup whatever is on the first machine into the second machine,
> 
> but my problem is; I want to configure my DNS server and Apache server so 

This is a DNS+apache queastion.

> that they can point to this two machine so that if someone wants to access 
> either machines the DNS can do an auto balance and redirect accordingly, 
> Please do assist on how I can solve this thanks again.

There are several ways of doing what you want.

What I did recently was use "dynamic DNS" to modify the dns server data
according to which (or both or none) of the mirrors was up. I set a
script to poll the two every two minutes from the dns server, and when
appropriate, I did a

    nsupdate <<EOF
    update del www.me.mine 120 CNAME serverX.me.mine
    EOF

or a

    nsupdate <<EOF
    update add www.me.mine 120 CNAME serverY.me.mine
    EOF

Which modifies DNS accordingly. Provided both apaches are configured to
host the virtual site www.me.mine, that's the end of the story. Well,
you need a short negative TTL on the DNS page, and maybe a short
refresh too. And the DNS server needs "allow-updates-from localhost;"
(or whatever the exact syntax is). And "multiple-cnames yes;".

You can also use a floating IP alias instead of a floating
(round-robin) name. This is the classic scenario, and copes with
one or the other of the servers being up as primary (but not both).
Each server should detect the presence of the other and raise (or
not raise) the floating IP as an IP alias, as appropriate. DNS
should only have one entry for www.me.mine, and that should be to the
floating IP.

Beyond that, things start getting fancier and more complicated. You
can firewall just in front of the servers and load balance to them
through the firewall.


Peter