Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

is there a way yo add 2 hosts per domain so if i host dies it automatically switches to the other one?

or if its slow you can easily switch to the second host?

Thanks!

share|improve this question
1  
It's called load balancing. –  Lekensteyn Apr 6 '11 at 21:38
add comment

1 Answer

Yes there are ways to do this but it's a fairly big topic with several different approaches.

The cheapest and simplest way to do this is with DNS. A DNS server gives the ip address of your domain when queried, you have some monitoring that detects when one of your hosts is down and tells the name server to stop giving out the ip of the broken server. normally DNS results are cached often for a day, so you need to the name server to say the record is only valid for a short time, however some isp's will ignore this and cache the record anyway. DNS was no really designed for this and it's not considered a good solution for large sites.

If your site relies on a database you need to make sure this is kept up to date on both servers or kept on a separate server. You can do master/slave database replication if the database is busy and important.

The other switching solutions are much more expensive. You can have two load balancers which distributes to several web servers, a heartbeat system monitors load balancers and the spare takes over the ip should the first fail. You can use BGP to change network routes if a server fails. You can have one ip address in several locations called multihoming.

As I said a big topic but for a small site DNS fail over is best. There are companies offering this as a service but if you have the TTL of your DNS records set low, say one hour then you may be able to change manually, this will be good enough in a lot of cases.

share|improve this answer
    
thanks a lot for the info! –  Karington Apr 7 '11 at 12:07
add comment

Your Answer

 
discard

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.