[nzlug] Webserver - Automatic Failover

Jim Cheetham jim at gonzul.net
Wed Jun 27 19:49:25 NZST 2007


On 27/06/07, Liam Farr <liam at farr.net.nz> wrote:
>
> Location 1
> Primary DNS (Centos Based, BIND9)
> Web server (Apple OSX, apache, mysql, php)
> Location 2
> Secondary DNS (Any os, server to be built)
> Web server (Any os, server to be built, apache, mysql, php)


Inherently both DNS and email are pretty much fail-over-able out of the box.
However it's arguable that email doesn't need to be redundant at all, as a
short outage (in the order of ~<24 hours) will pretty much automatically
recover automatically. You don't need an independant machine just for DNS,
it's low-load and should be on the other service machine.

The web server is more interesting, however. Unless your two application
back-ends are aware of each other, you will have session/cookie affinity
with only one server at a time. There will not be an effective way of moving
a user session from one server to another, should one go down.

I recently saw a nice trick for cheap redundancy, which assumes you're
protecting only against an outage of a site or server, as opposed to "just
apache". Have two master DNSs on the two machines, with slightly different
zone data - machine 1's DNS says that machine 1 is the webserver; machine
2's DNS says that machine 2 is the webserver. Declare any of the machines as
the primary DNS - say number 1. When machine 1 goes off the air, you lose
all the current user sessions (until they restart their browsers) ... but
any new request for DNS will automatically retry onto machine 2 ... and be
told that the webserver is on machine 2.

This will scale up to 3 or 4 machines ... it's unusual to have more than 4
DNS servers named in the registry, but not impossible for some.

You're bound to have more questions ... :-)

-jim


More information about the NZLUG mailing list