多台服务器如何为 Web 应用程序同步工作? [英] How do multiple servers work in sync for web application?

查看:31
本文介绍了多台服务器如何为 Web 应用程序同步工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  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?

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

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?

推荐答案

ultramonkey 会给你很好地描述了如何在多台服务器之间进行负载平衡,因此您会看到 1 个 IP 地址,但连接被路由到多台服务器之一(包括容错).

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).

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

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)

在真正容错的情况下您需要的另一个问题是将物理服务器放置在彼此远离的地方,这会引起大多数共享设计的性能问题(即,如果它们存在,则您不能将所有服务器都放在 SAN 上)'在不同的国家/地区),是使用多服务器方法,使用单个 DNS 名称并定期在它们之间复制数据.DNS 负载平衡 可能是使用多个的最简单方法网络服务器作为一个网站.

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.

这篇关于多台服务器如何为 Web 应用程序同步工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆