We help IT Professionals succeed at work.

Faillover at best price :-)

steph84 asked
I'm looking for a smart/working solution to do some "basic" failover : I'm not looking for clustering solutions or things like that. At best, we shouldn't use anyhting else than existing hardware/software  (Linux/Apache, Unix/Apache, and even some IIS beeeuuaaah!) and our DNS servers :-), but I'm open to all ideas.....
200 points, to have a maximum of interesting answers!!
Watch Question

I guess you should elaborate on what exactly you want to achive ...!?

What is served? Static Pages or Database output?
How often is the content updated? How recent does the "mirror" have to be, etc?


With DNS the failover is implicit. Just have two nameservers, one master and one slave. DNS Resolver can handle a server, being down and "bind" as replication implemented.


Just static pages, content not updated often, mirroring done manually each week for example. Some very basic stuff in fact...
With DNS servers, I'm able to do some round robin, but if one of the 2 servers is down, round robin still send request to the broken one, correct me if I'm wrong????

You are right. What I meant is, that you should have two DNS Servers, to backup each other.

Regarding your webserver I suggest you just configure one machine to do the job right. Using a reliable hardware configuration makes sense (e.g. new harddisk), no unused hardware (e.g. soundcard).

I then suggest having a 2nd "cold" mirror and a way of monitoring the availability of your server (maybe through the mirror machine).

I case of a failure you can then easily switch to the backup manually.

This is not really High Avalibility, but in my opinion HA is a bitch. You easily got more effort and downtime by misconfiguration, then you'd have with a "cold mirror" solution.

For monitoring you could just use a simple script, that checks if your server is still up, e.g. by getting robots.txt. If not you should send yourself a pager message.


You might want to check Apache's rewriting guide:

It is straight from Apache's website.

URL: http://httpd.apache.org/docs/misc/rewriteguide.html

--- excerpt.
     Load Balancing

          Suppose we want to load balance the traffic to www.foo.com over www[0-5].foo.com (a total of 6 servers). How can this be done?
          There are a lot of possible solutions for this problem. We will discuss first a commonly known DNS-based variant and then the special one with
             1.DNS Round-Robin

               The simplest method for load-balancing is to use the DNS round-robin feature of BIND. Here you just configure www[0-9].foo.com as
               usual in your DNS with A(address) records, e.g.

                www0   IN  A
                www1   IN  A
                www2   IN  A
                www3   IN  A
                www4   IN  A
                www5   IN  A

               Then you additionally add the following entry:

                www    IN  CNAME   www0.foo.com.
                       IN  CNAME   www1.foo.com.
                       IN  CNAME   www2.foo.com.
                       IN  CNAME   www3.foo.com.
                       IN  CNAME   www4.foo.com.
                       IN  CNAME   www5.foo.com.
                       IN  CNAME   www6.foo.com.

               Notice that this seems wrong, but is actually an intended feature of BIND and can be used in this way. However, now when www.foo.com
               gets resolved, BIND gives out www0-www6 - but in a slightly permutated/rotated order every time. This way the clients are spread over the
               various servers. But notice that this not a perfect load balancing scheme, because DNS resolve information gets cached by the other
               nameservers on the net, so once a client has resolved www.foo.com to a particular wwwN.foo.com, all subsequent requests also go to this
               particular name wwwN.foo.com. But the final result is ok, because the total sum of the requests are really spread over the various

             2.DNS Load-Balancing

               A sophisticated DNS-based method for load-balancing is to use the program lbnamed which can be found at
               http://www.stanford.edu/~schemers/docs/lbnamed/lbnamed.html. It is a Perl 5 program in conjunction with auxilliary tools which provides a
               real load-balancing for DNS.

             3.Proxy Throughput Round-Robin

               In this variant we use mod_rewrite and its proxy throughput feature. First we dedicate www0.foo.com to be actually www.foo.com by
               using a single

                www    IN  CNAME   www0.foo.com.

               entry in the DNS. Then we convert www0.foo.com to a proxy-only server, i.e. we configure this machine so all arriving URLs are just
               pushed through the internal proxy to one of the 5 other servers (www1-www5). To accomplish this we first establish a ruleset which contacts a
               load balancing script lb.pl for all URLs.

                RewriteEngine on
                RewriteMap    lb      prg:/path/to/lb.pl
                RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]

               Then we write lb.pl:

                ##  lb.pl -- load balancing script

                $| = 1;

                $name   = "www";     # the hostname base
                $first  = 1;         # the first server (not 0 here, because 0 is myself)
                $last   = 5;         # the last server in the round-robin
                $domain = "foo.dom"; # the domainname

                $cnt = 0;
                while (<STDIN>) {
                    $cnt = (($cnt+1) % ($last+1-$first));
                    $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
                    print "http://$server/$_";


               A last notice: Why is this useful? Seems like www0.foo.com still is overloaded? The answer is yes, it is overloaded, but with plain proxy
               throughput requests, only! All SSI, CGI, ePerl, etc. processing is completely done on the other machines. This is the essential point.

             4.Hardware/TCP Round-Robin

               There is a hardware solution available, too. Cisco has a beast called LocalDirector which does a load balancing at the TCP/IP level. Actually
               this is some sort of a circuit level gateway in front of a webcluster. If you have enough money and really need a solution with high
               performance, use this one.

any luck so far?

Explore More ContentExplore courses, solutions, and other research materials related to this topic.