开发者

Go to specific server depending on which is up?

I have two servers, in different locations, running the same site (the second one, i think, would be called a "mirror"). I prefer the first one, but it has not-so-good uptime. I would like to create a website (in Javascript, HTML, Silverlight, or ASP.NET C# if pos开发者_如何学Csible) that checks if website #1 is up, and (if it is up) send the user there. If it's not up, it should forward the user to server #2. How can I check if the server is up (like http://isup.me/) and how can i forward the user there? Thanks!


There are many DNS providers that will do this for you automatically. The feature is called "Failover DNS" and it works like this:

for your domain e.g. example.com, you'd set an A record for the IP of server #1 (say it's ip is 123.123.123.123)

example.com A 123.123.123.123 TTL: 300s

www.example.com would be a CNAME to example.com

Then you would add server 2's IP address to the failover list for example.com. Then the provider will check server #1 every few minutes to see if it's up. Most providers allow you to configure how often and what to check to determine that it is indeed up.

If server #1 is down, the provider will start serving Server #2's ip address, so all traffic will be directed there.

You can read more about it here: http://www.dnsmadeeasy.com/enterprisedns/dnsfailover.html

Another provider that supports this is zerigo.com


If you are working for a company and scaliablity is a concern in future , please use some loadbalancer which automatically does it for you.

there are various options with loadbalancer to load the balance and route the traffic.


If you're using IIS 7, take a look at this article about Load Balancing. http://learn.iis.net/page.aspx/486/http-load-balancing-using-application-request-routing/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜