Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been reading about DNS failovers and a bunch of other technical terms however I'm a bit of a newbie in this so it all sounds Greek to me. Basically here's what I just need:

I have two shared hosting accounts from two different providers (Server A and Server B). Each of this accounts contain exactly the same website content.

On a normal day, typing my domain name should point to the IP of Server A. But on a bad day in which Server A is down or unreachable, my domain name should point to the IP of Server B in the fastest way possible.

How do you achieve this and what services can you recommend if any? Thanks.

Note: this question has a follow-up question: DNS Round Robin: Multiple Nameservers VS Multiple A Records?

share|improve this question
up vote 2 down vote accepted

The simple answer is to use a content distribution/delivery network to handle your traffic. They already have the infrastructure in place to handle failover like this.

If you must host it yourself, one route to take is this:

  • Set the DNS TTL very low
  • Set up a server which monitors the web servers
  • If one of the web servers goes down, automate a script on the monitoring server to modify the DNS and remove the failed server

My first recommendation is still to use a CDN, though.

share|improve this answer
Thanks for the reply. Can a CDN be used as a host for an entire website? I thought it's only used for storage. – IMB Mar 25 '11 at 19:53
CDNs are generally best for static content (HTML, JS, CSS, images, etc), but some CDN hosts offer whole site delivery for sites with server-side applications. It's not cheap, though, but 99.999% uptime never is. – Hyppy Mar 25 '11 at 20:03
If that's the case then I would need a CDN that offers whole site delivery because a normal CDN implementation will not achieve my goal right? – IMB Mar 25 '11 at 20:19
I don't know. Do you run any server-side applications? – Hyppy Mar 25 '11 at 20:22
Search for 'DNS failover'. Some companies offer it inexpensively. – Seun Osewa May 9 '11 at 4:49

It will never work only with shared hosting accounts. You will need something intelligent to handle outages. There is many options:

1. CDN as wrote @Hyppy

This is simplest and we can say cheapest solution for static content. You will upload you static content (js, html, images and so on) into CDN and it will distribute it across the globe. You have high availibility for your content and your visitors will download your content from nearest servers, not across the whole Internet. CDN cannot serve dynamic content (ok, some like Akamai can, but it's expensive and cannot provide everything)

2. Loadbalancer

You would set up your own server as loadbalancer using HAProxy. You'd point your DNS records to the loadbalancer and the loadbalancer will route traffic to target servers. Loadbalancer can manage load distribution when all servers are ok and disable traffic when some servers die.

If you need HA, you should have more loadbalancers in backup using virtual IP (using something like KeepAlived). This is quite simple to achieve if both of your loadbalancers are on same network, but it is quite difficult if you want to have those loadbalancers in different providers (you will end up with something called multihoming AS, your own IP subnet and another stuff). You can use specialized hardware as loadbalancers, like appliances from F5.

This is an expensive solution in terms of buying, but can be cheaper than CDN in terms of TCO and you're not limited in terms of what you handle.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.