大网数据广告活动
服务器运维问答

How do I distribute HTTP traffic to the closest server?

· 52CE 我爱测

This is kind of a two part question. So I have a DigitalOcean Droplet in Toronto with a lamp stack on it (with a website of course). I want to be create a snapshot of that droplet and deploy a clone in perhaps San Francisco and A…

问题原文

原帖链接 · Kipplex-Chase · CC BY-SA 3.0

This is kind of a two part question. So I have a DigitalOcean Droplet in Toronto with a lamp stack on it (with a website of course). I want to be create a snapshot of that droplet and deploy a clone in perhaps San Francisco and Amsterdam.

  1. How do i accomplish routing to the server with the least latency based on location?

  2. How do I clone these sites in real time. For example if I edit the website, the change is reflected over all the servers?

Thanks

社区高分解答

原帖链接 · Tim · CC BY-SA 3.0

You can use AWS Route 53 latency based routing. I'm fairly confident you can use R53 with non-AWS sources.

Alternately CloudFlare have a traffic manager which can do "geo steering". It may still be in beta, and I don't know if it's on the free or paid plan.

Update I just noticed your second question. I'm going to assume your aim is primarily page load time, with a secondary concern of service availability. I'm further going to assume the website is Wordpress, because it's more difficult to do what I'm suggesting below with stock software than custom written.

If you want the two sites serving traffic at the same time, in sync, you'll have to consider some kind of multi-master database replication. This isn't that simple, but there are techniques to do it. Digital Ocean has a tutorial here. RSync or BitTorrent sync will will deal with file replication.

If your sole goal is fast response times then you might be just as well off using a single server with a CDN to ensure your static resources are served locally - CloudFlare is good for that. Your latency for one request for the page probably isn't that significant, around 100ms extra, other resources will be served from the nearest node.

If your sole goal is redundancy in case of failure you might still consider for the database a master/read replica type scenario. Have all traffic routed to one server, with the database and files replicating live to the second site. If the main site goes down you fail over to the second site. If this happens you need to work out what to do when the main site comes back online, how you get things back in sync. In this case multi master still might be easiest, to keep things in sync.

Unfortunately what you're trying to do isn't entirely trivial, and can be moderately to exceptionally complex depending on your use cases. We really need to understand your goals to offer better solutions.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-10-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。