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

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

问题描述

  1. 我的第一个问题是,我经常读到有关人们使用多个专用服务器来运行其网站并处理用户查询的信息.但是他们到底是怎么做到的呢?我的意思是,当我输入域名时,DNS会将其解析为IP地址,但是在那之后我迷路了.服务器?

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

解决方案

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

如果您的Web服务器没有使用相同的存储(公共存储可能很棘手,则必须使用 GFS )或数据库)那么您应该启用粘性会话,该会话可以告诉路由器每个客户端将选择一台服务器进行首次通信,并保持与该服务器的通信.这不太容错(但是在Web中,您只需要刷新断开的连接即可重新开始),但架构起来则容易得多(并且由于每个Web服务器都可以保持独立,因此速度更快)

在真正的容错情况下,您还需要解决的另一个问题是将物理服务器放置在相距较远的位置,这会给大多数共享设计带来性能问题(即,如果它们不能将所有服务器都放在SAN上,是在不同的国家/地区),就是使用多服务器方法,使用一个DNS名称,并定期在它们之间复制数据. DNS负载平衡可能是使用多个Web服务器作为单个网站.

在这些情况下,数据库通常可以是所有服务器都可以与之通信的单个数据库,也可以使用群集或更常见的日志传送方式进行共享,以确保在主数据库出现故障时可以准备上线的备份.对于备份服务器,日志传送比在远处更为常见.

  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?

解决方案

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.

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

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