Web 应用程序的多个服务器如何同步工作?

发布于 2024-07-22 02:57:22 字数 232 浏览 6 评论 0原文

  1. 我的第一个问题是,我经常读到人们使用多个专用服务器来运行他们的网站并处理用户的查询。 但他们究竟是如何做到这一点的呢? 我的意思是,当我输入域名时,DNS 会将其映射到 IP 地址,但在那之后我就迷失了……是否有某种主/从架构可以在(可能)数百个传入请求之间进行负载平衡服务器?

  2. 如果是这样的话,各个服务器如何共享数据(例如数据库)? 它们会连接到同一个硬盘吗?

  1. My first question is, I often read about people using multiple dedicated servers to run their websites, and process queries from users. But how do they exactly do this? I mean, when I enter a domain name, a DNS resolves maps that to an IP address, but I am lost after that.. is there some kind of master/slave architecture there to load balance incoming requests amongst the (potentially) hundreds of servers?

  2. If that's the case, how do the various servers, share data (database for e.g.)? Will they be connected to the same hard disk?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一念一轮回 2024-07-29 02:57:22

ultramonkey 将为您提供有关如何在多个服务器之间进行负载平衡的详细说明,因此您会看到 1 IP 地址,但连接被路由到许多服务器之一(包括容错)。

如果您的 Web 服务器没有使用相同的存储(公共存储可能很棘手,您必须使用 SAN 具有“共享”文件系统,例如 GFS 或数据库),那么您应该启用粘性会话,告诉路由器每个客户端将选择一个第一次与服务器通信,并与该服务器保持联系。 这容错性较差(但在网络中,您只需刷新断开的连接即可重新开始),但架构起来更容易(并且速度更快,因为每个网络服务器都可以保持独立)

。真正的容错情况是将物理服务器放置在彼此远离的地方,这会给大多数共享设计带来性能问题(即,如果它们位于不同的国家,则不能将所有服务器放在 SAN 上),方法是使用多个服务器方法,使用单个 DNS 名称并定期在它们之间复制数据。 DNS 负载均衡可能是使用多个Web 服务器作为单个网站。

在这些情况下,数据库通常可以是所有服务器都可以与之通信的单个数据库,或者可以自行共享,使用集群或更常见的日志传送来确保您有一个备份可以在主数据库发生故障时准备好上线。 日志传送对于备份服务器来说比位于远处的服务器更常见。

ultramonkey will give you a good description of how to load-balance across many servers, so you see 1 IP address but the connection gets routed to one of many servers (with fault tolerance included).

If you don't have your web servers using the same storage (common storage can be tricky, you have to use a SAN with a 'shared' filesystem like GFS, or a database) then you should enable sticky sessions which tell the router that each client will choose a server to communicate with the first time, and keep with that server. This is less fault-tolerant (but in the web you'll just have to refresh a broken connection to start over) but much easier to architect (and faster as each web server can remain independent)

The other issue you'd need in a truly fault-tolerant situation is to locate the physical servers far away from each other, which raises performance issues for most sharing designs (ie you cannot put all your servers on a SAN if they're in different countries), is to use the multiple servers approach, using a single DNS name and replicate data between them regularly. DNS load balancing is possibly the easiest way of using multiple web servers as a single website.

In these cases, the DB can often be a single database that all servers communicate with, or can be shared themselves, using clustering or more often log-shipping to ensure you have a backup ready to come online should the primary fail. Log-shipping is more common for backup servers than are located far away.

淡看悲欢离合 2024-07-29 02:57:22

1)您可以使用NLB(网络负载平衡)-它将为场中的所有服务器使用相同的IP
http://en.wikipedia.org/wiki/Network_Load_Balancing_Services
http://technet.microsoft.com/en-us/library/cc759510。 aspx

2) 数据库的 SQL 集群和非关系数据的公共文件存储
http://www.sql-server-performance.com/articles/聚类/clustering_intro_p1.aspx

1) You can use NLB (Network Load Balancing) - it will use the same IP for all servers in the farm
http://en.wikipedia.org/wiki/Network_Load_Balancing_Services
http://technet.microsoft.com/en-us/library/cc759510.aspx

2) SQL clustering for the DB and a common file store for the non-relation data
http://www.sql-server-performance.com/articles/clustering/clustering_intro_p1.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文