redirect to mirror website automatically?
What would be 开发者_运维问答the best way to automatically redirect to a mirror website if the main website being is down? Should it be done via DNS, and how can I set this up? Basically, what I need is to have an exact copy of the site (not frequently updated, so no synchronization necessary) to be a fall back incase of failure. Kind of almost like a load balanced solution.
What is your requirement? Changing DNS is possible, but due to DNS caching it could take up to 24 hours before the failover to your mirror is complete (i.e. everybody on the internet sees your mirror).
Do you need it to be automatic? Or is manually changing DNS records acceptable?
If you need instant failover without customers noticing downtime a solution with redundant hardware and load balancers is more appropriate (but also much more costly and complicated to maintain).
The codes for redirecting pages are 301 (permanent redirection) and 302 (temporary redirection). These codes are universal for all webservers, and that is where you should look to implement such changes.
Here's a very simple example using apache: about.com
Good Luck,
Yishai
精彩评论