使用HAProxy进行负载平衡SQL Server 2008 [英] Using HAProxy for load-balancing SQL Server 2008

查看:163
本文介绍了使用HAProxy进行负载平衡SQL Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以/可行/合理地使用HAProxy对三台SQL Server 2008数据库服务器进行负载平衡?

Is it possible/feasible/reasonable to use HAProxy to load-balance three SQL Server 2008 database servers?

这是我们的情况:我们有两个在Amazon EC2上实现负载平衡的Web服务器.我们目前正在使用一台生产SQL Server 2008 DB服务器.该服务器开始过载,因此我们想再添加两个数据库服务器,并实施负载平衡解决方案.

Here is our situation: we have two web servers that are load-balanced on Amazon EC2. We are currently using one production SQL Server 2008 DB server. That server is starting to get overloaded, so we would like to add two more DB servers, and implement a load-balancing solution.

在Amazon EC2中,我们无法使用虚拟IP地址,这使我们无法使用Windows网络负载平衡(NLB)或任何其他需要VIP的负载平衡方法.

In Amazon EC2, we are unable to use a Virtual IP address, which prevents us from being able to use Windows Network Load Balancing (NLB) or any other load-balancing method that requires a VIP.

我们的应用程序读取量很大,但是我们无法将读取与写入分开,因此负载平衡解决方案需要解决这一问题.

Our application is read-heavy, but we are unable to separate reads from writes, so the load-balancing solution needs to account for this.

我们正计划使用SQL Server的内置复制功能来保持所有三个数据库的最新状态(我们知道会有一些滞后时间,但这是可以接受的.)

We are planning on using SQL Server's built-in replication feature to keep all three DB's current (we understand that there will be some lag time, but that is acceptable).

欢迎提出任何想法或建议,在此先感谢您的帮助.

Any thoughts or suggestions are welcome, and thanks in advance for your help.

推荐答案

是的,这是可行的.我已经在实验室尝试过,并且效果很好.

Yes this is feasible. I've tried it in labs and it works well.

如果您有足够大的Web服务器场,则可以通过IP哈希使会话保持粘性,这将解决复制延迟问题.负载不会平均分布,但是即使给定连接池(假设您使用的是.NET),负载也可能不会如此

If you have a large enough farm of web servers you can make the session sticky by IP hashing which will solve the replication latency problem. The load won't be as evenly spread but the load probably won't be that even anyway given connection pooling (presume you are using .NET)

并且,如果您使用合并作为复制拓扑,则该解决方案原则上应具有良好的伸缩性,并且具有足够的弹性,只要您能够在应用程序级别处理奇数掉线的连接,就可以关闭单个服务器进行维护.

and if you use merge as your replication topology the solution should - in principle - scale well and be resilient enough that you can take individual servers down for maintenance so long as you are able to handle the odd dropped connection at application level.

这篇关于使用HAProxy进行负载平衡SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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