大网数据广告活动
网站运营与故障问答

Can I use one domain name with two servers from different hosting companies?

· 52CE 我爱测

I have a WordPress website. These days I'm having physical memory limitations. I tried to fix it and did well except the memory usage (RAM) usage is still high. Not as high as before, but still not good. I have a Linux hosting wi…

问题原文

原帖链接 · Master Iori · CC BY-SA 3.0

I have a WordPress website. These days I'm having physical memory limitations. I tried to fix it and did well except the memory usage (RAM) usage is still high. Not as high as before, but still not good.

I have a Linux hosting with cPanel in Godaddy which is where my domain is based, and I have another hosting on Obambu. Can the domain work under the two hosts? I mean with the same database and both servers presenting content to users?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 3.0

There is a technique that could make it work, sort-of: round robin DNS. You can add two DNS records for the same name with two different IP addresses. In theory, clients should get one of two of the IP values and half your traffic should hit each of your servers.

In practice round robin DNS has problems:

  • One of your servers will end up getting more traffic than the other. This is due to DNS servers making a choice for all their users and serving just one of the two values to many users.
  • If one of your servers goes down, the half of users that would hit it won't be able to get to your site. There is nothing that will route them to the other server that is still up. This makes your site twice as fragile as it was with only one server and makes it hard to do scheduled down time and maintenance.

It is better to get two servers at the same web host and put a load balancer in front of them. A load balancer only works on a local network, but it routes traffic to servers based on whether or not they are actually up. It also allows you to control traffic percentages much better.

With either round robin DNS or a load balancer, you will need two central things to run WordPress:

  1. Your database which stores posts and users
  2. Your wp-content directory which stores images and themes

To use two servers, you will need to set both of them up to use a central database and a network file system for wp-content.

Another option is to continue with a single server but put a content delivery network (CDN) in front of it. A CDN is a set of caching proxy servers designed to be close to your users. A CDN will reduce the load on your main server while making your site faster for users. Because there is caching, it is hard to use this technique with highly dynamic websites.

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

资料来源与适用范围

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

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

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