自动重定向到镜像网站?
如果主网站关闭,自动重定向到镜像网站的最佳方法是什么?应该通过 DNS 完成吗?我该如何设置?基本上,我需要的是拥有该网站的精确副本(不经常更新,因此不需要同步),以便在出现故障时作为后备。有点像负载平衡解决方案。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的要求是什么?更改 DNS 是可能的,但由于 DNS 缓存的原因,可能需要长达 24 小时才能完成到镜像的故障转移(即互联网上的每个人都可以看到您的镜像)。
你需要它是自动的吗?或者手动更改 DNS 记录是否可以接受?
如果您需要即时故障转移而不让客户注意到停机,那么具有冗余硬件和负载平衡器的解决方案更合适(但维护成本也更高且更复杂)。
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).
重定向页面的代码为301(永久重定向)和302(临时重定向)。这些代码对于所有网络服务器都是通用的,您应该在其中实现此类更改。
这是一个使用 apache 的非常简单的示例: about.com
祝你好运,
Yishai
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