1

Is there a way to host a website on multiple hosts. exactly the same site, for example on hosting companies HostingABC and HostingDEF?

In case there is ever a problem with HostingABC (either a temporary problem such as down time, or permanent such as HostingABC going bankrupt) then the site is still available through HostingDEF on the same domain.

Is this possible? How to set it up?

I don't care if both are accessible at the same time, or only one is and the other one takes over after the first one is down. Also it should work with more than two hosts.

Thanks for pointing me in the right direction.

It's worth noting that the site itself is nothing special in demands. PHP + MySQL is pretty much it.

2 Answers 2

2

Sounds like you're looking for round-robin DNS, routine database synchronizations, and routine code copies.

Should be a pretty simple setup :)

7
  • indeed. it is. thank you will look into it and how to implement it.
    – b0x0rz
    Oct 3, 2009 at 15:39
  • 1
    It's only simple if you have full access to the server on both hosting companies. Otherwise it is simply impossible.
    – Lothar
    Oct 3, 2009 at 17:23
  • @Lothar - synchronizing a db is pretty simple even without full access - yo can run a script to SELECT all from one and INSERT it into the other; any hosting company that lets you setup DBs also should be giving you an interface for management (if you have shared hosting) like phpMyAdmin
    – warren
    Oct 4, 2009 at 1:21
  • @warren - that's a bit simplistic and would only work if the 'other' server is passive. If a site needs redundancy, I'd say they also need something more sophisticated, like replication. Nov 5, 2010 at 17:41
  • @Martijn Heemels - I believe that's about what I said .. "routine database synchronizations, and routine code copies" .. yes, you can go far more in-depth, but depending on the change frequency, that may be truly all that is needed
    – warren
    Nov 6, 2010 at 22:03
3

Round robin is cheap and easy but may be not be the best solution for you. In a round robin setup you put all of the servers for that domain into one A record and DNS servers hand out one (and only one) of those records to any request. If you have three servers and two are down round robin will direct your customers to non-functioning web servers and error messages on average 2/3 times. Alternatively you could try short TTL DNS records and be updating your DNS manually or automatically as servers go up and down. Not much fun, that and it scales poorly.

Unfortunately the cost and complexity ramp up pretty quickly from there. Since your two servers are on different networks (and I am assuming different locations?) you'd need to look at a load balancer (or just a proxy) that answers web requests and relays them to whichever server(s) are up. It would need to be at one of the locations/networks you have (making that one more critical for failures, or at another location, adding complexity and still being pretty critical. You'll have to look into putting together the proxy yourself, buying one as an appliance, or working with a service provider who can do some of this for you.

And synching: As noted above you'll need to keep the databases synched with MySQL replication or another tool, either master-slave or multi-master, depending on your read/write ratios and performance requirements. And the code will have to be kept in sync across the front ends. I strongly recommend a master repository (eg SVN) that you use to populate the frontends for speed, ease of management, and peace of mind.

You have some work ahead of you if this is the way things need to go. G'luck and have fun!

2
  • I've not see round-robin direct me to a non-functioning server before, but maybe it was just on really really short TTLs?
    – warren
    Oct 4, 2009 at 1:22
  • 2
    I find that quite odd, but configurations likely differ. Wikipedia has a good explanation for how round robin is implemented and it's limitations: en.wikipedia.org/wiki/Round_robin_DNS
    – adric
    Oct 4, 2009 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .