LSX-blog

Feed Rss

【转载】WINDOWS2008网络负载平衡群集(NLB)完全攻略

03.17.2012, 系统, by .

这篇文章写得非常好,从NLB原理到实验过程都写得非常详细。在此感谢原作者。

1. 什么是群集?

群集是指一组服务器,通过彼此的协同作业,提供一个相同的服务或应用程序,用于提升服务或应用程序的可用性(availability)、可靠性(reliability)和可扩展性(scalability)。当群集内的服务器down掉以后,服务请求会转给其它群集内的节点,以实现24小时不中断的服务

2.Windows server 中的群集类型

Windows server 支持三种类型的群集,分别是NLB、CLB和MSCS。NLB与MSCS内置于windows server中,CLB需要购买Application Center

a) NLB:提供以TCP/IP 为基础的服务与应用程序的网络流量负载均衡,用于提升系统的可用性和可扩展性。常见的应用有Terminal Service、Web、VPN与FTP等。

b)  CLB:提供使用COM+组件的中介层应用程序的动态负载均衡,用于提升系统的可用性和延展性。CLB会依据目前的工作负载来决定由谁来处理服务请求。

c) MSCS:提供后端服务与应用程序的容错移转(failover),主要是提升系统的可用性。常见的应用有SQL Server与Exchange Server等。MSCS是由client来决定由谁来处理服务请求,所有服务器共享一个share storage来储存session状态。当主动服务器挂了,则继续由被动服务器接手。被动服务器会从share storage取出session状态,继续未完成的工作,以达到容错移转的目的

3. NLB的工作原理:

a)  图示:

128946871236

b) 节点A与节点B均有一个外部使用的静态IP地址,创建NLB群集时会产生一个虚拟的IP,该IP与节点的IP在同一个网段内,对外公布的 IP为虚拟的群集IP,而客户机所访问的实际上为节点A或者节点B。

4. WINDOWS2008下的NLB配置:

a)NLB配置的环境要求:

i.  网卡:所有网卡必须与WINDOWS2008兼容,单网卡或多网卡均可配置该服务,推荐使用多网卡。

ii. 网络模式:工作组和域环境均可完成,在2008中最多可以支持32个节点。

iii.  交换机和路由器要求:交换机必须支持VLAN,有些交换机和路由器有可能需要手工设置多播MAC地址。

iv. 通讯协议:绑定到群集的网络适配器只能安装TCP/IP协议,必须静态分配,不支持DHCP。

v.  应用程序的要求:必须是TCP或UDP通讯,而且确定当前应用程序或服务必须支持NLB。

b) 实验拓朴图:

两台windows 2008 entprise edition 双网卡服务器

128946871582

c)实验步骤:

i.搭建网络并测试网络连通性(按图示上的网络配置)

ii.  在两个节点上分别安装WEB服务并设置不同的html文档,方便检测实验效果:

128946888032

128946889058

iii. 安装网络负载平衡管理工具

128946889861

iv. 输入NLBMGR打开NLB管理器—群集—新建—输入当前节点A的主机名:128946890158

v.  点击”连接”后选择用于配置群集的网络接口。

128946924558

vi.  添加群集虚拟IP

128946924736

vii.  设置FQDN,选择群集操作模式(推荐使用双网卡单播模式)

单播:单播模式是指各节点的网络适配器被重新指定了一个虚拟MAC(由02-bf和群集IP 地址组成确保此MAC的唯一性)。由于所有绑定群集的网络适配器的MAC都相同,所以在单网卡的情况下,各节点之间是不能通讯的,这也是推荐双网卡配置的原因之一。为了避免交换机的数据洪水,应该结合VLAN使用。

多播:网络适配器在保留原有的MAC地址不变的同时,还分配了一个各节点共享的多播MAC地址。所以,即使单网卡的节点之间也可以正常通讯,但是大多数路由和交换机对其支持不是太好。

IGMP多播:IGMP多播(只有在选中多播时,才可以选择此项),在继承多播的优点之外,NLB每隔60秒发送一次IGMP信息,使多播数据包只能发送到这个正确的交换机端口,避免了交换机数据洪水的产生。

128946927262

viii.  配置端口规则后确定并等待聚合完成:

128946932388

群集IP地址:指定规则所针对的群集IP

端口范围:默认为所有,可以指定群集监听的端口范围(如从80到80,表示只针对web服务实现负载均衡)

协议:指定群集所服务的协议类型

筛选模式:a:多个主机:

     无相似性: 客户端的服务请求会平均分配到群集内的每一部服务器。假设NLB群集内有2部服务器。当接到客户端的请求时,NLB会将第1个请求交由第1部服务器来处理,第2个请求交由第2部服务器来处理,第3个请求交由第1部服务器来处理,…依此类推。因为所有客户端联机会平均分配到每一部服务器,因此可以达到最佳的负载平衡。如果需要执行交易处理,为了能够共享session状态,则必须将session状态集中储存在state或database server中,这种方式适用于大部分的应用程序。

     单一相似性:客户机的服务请求会固定分配到群集内的某一部服务器。当接到客户机的请求时,NLB会根据客户机的IP来决定交由哪一部服务器来处理,也就是一部服务器只会处理来自某些IP的请求。因为一个IP的服务请求只会固定由一个服务器来处理,因此没有 session状态共享的问题,但可能会导致负载不平衡。这种方式适用于联机需支持 SSL 集多重联机的通讯协议 ( 例如FTP与PPTP等)

      网络(类C):根据IP的Class C屏蔽来决定交由哪一部服务器来处理,也就是一部服务器只会处理来自某些网段C的请求。这种方式可确保使用多重 Proxy 的客户端能导向到相同的服务器。

    b.单一主机:若选择此选项,该端口范围内的所有请求都将由一台主机来进行处理,此选项将配合后面的主机优先级来进行主机判定。

    c. 禁用此端口范围:一般这个选项会在端口例外中进行设置,也就是说,当我们指定了一个比较大的范围端口时,其中有一个或几个端口我们不需要 客户端用户访问到,这时我们将利用这个规则来进行设定,防止用户访问此端口请求。  

ix. 聚合完成后在第二个节点上连接到已经创建好的群集

128946932579

x. 将第二个节点加入到现存群集

128946934397

xi.  聚合完成后通过群集ip可访问WEB站点

128946934530

xii.  断开节点A的网络连接后,自动切换到节点B

128946959316

     至此所有操作完成,特别注意:在生产环境中使用除非你确定你们公司的路由器支持多播模式,否则请最好使用双网卡单播模式,并在路由上对ARP表做手动设置,否则可能会出现跨网段无法访问群集ip的错误。

【转载】WINDOWS2008网络负载平衡群集(NLB)完全攻略 有 1,822 条回应

  1. Magnificent items from you, man. I’ve take into accout
    your stuff previous to and you’re just extremely wonderful.
    I actually like what you have received right here,
    really like what you are stating and the way in which wherein you assert it.
    You are making it enjoyable and you continue to care for
    to keep it sensible. I cant wait to learn far more
    from you. This is really a wonderful website.

    回复
  2. Hey There. I found your blog the use of msn. This is an extremely smartly written article.

    I will make sure to bookmark it and return to read extra of your helpful info.

    Thank you for the post. I will certainly return.

    回复
  3. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each
    time a comment is added I get four emails with the same
    comment. Is there any way you can remove people from that service?
    Many thanks!

    回复
  4. Remarkable! Its truly amazing piece of writing, I have got much clear idea
    regarding from this piece of writing.

    回复
  5. If some one desires expert view regarding blogging afterward i advise him/her to go to
    see this blog, Keep up the fastidious work.

    回复
  6. Wow, awesome blog structure! How lengthy have you been running a
    blog for? you make running a blog look easy. The full glance of your website is great,
    as smartly as the Kratom content material!

    回复
  7. I love it when people get together and share ideas.

    Great blog, continue the good work!

    回复
  8. Hey! I’m at work surfing around your blog from my new apple iphone!
    Just wanted to say I love reading your blog and look forward to all your posts!
    Carry on the outstanding work!

    回复
  9. Article writing is also a excitement, if you be acquainted with
    afterward you can write or else it is complicated to write.

    回复
  10. Excellent article. I absolutely appreciate this website.
    Thanks!

    回复
  11. What a information of un-ambiguity and preserveness of precious experience about
    unexpected feelings.

    回复
  12. [url=http://cleocing.com/]24 cleocin 150 mg cap[/url]

    回复
  13. I got this web page from my friend who informed me regarding this website and now this
    time I am browsing this web site and reading very informative content here.

    回复
  14. Students can discover how to heal injuries and relax patients by working through specific educational training.
    With the Speed Circuit the ball discussed is simply
    a flashing ball which adds to the cat’s amusement.

    Now allow that cool air to expand your cavity, an incredible massage for
    the abdomenal organs.

    回复
  15. Everything is very open with a very clear clarification of the challenges.
    It was truly informative. Your site is useful. Thank you for sharing!

    回复
  16. I’m very happy to find this great site. I want to to thank
    you for ones time just for this wonderful read!! I definitely appreciated every part of it and I have you book marked
    to look at new things in your site.

    回复
  17. This is my first time pay a visit at here and i am genuinely impressed to read
    all at one place.

    回复
  18. We are a group of volunteers and opening a new scheme in our community.

    Your website offered us with valuable information to work
    on. You’ve done a formidable job and our whole community will
    be grateful to you.

    回复
  19. I am glad to be a visitor of this consummate site, appreciate it for this rare info!

    回复
  20. I’m extremely impressed with your writing skills as well as with the layout on your blog.

    Is this a paid theme or did you customize it yourself?

    Anyway keep up the nice quality writing, it is rare to see
    a nice blog like this one nowadays.

    回复
  21. Wow, amazing weblog structure! How long have you been blogging for?
    you make running a blog look easy. The full glance of your web
    site is great, let alone the content!

    回复
  22. Hi! I know this is kind of off topic but I was wondering if you knew
    where I could get a captcha plugin for my comment form?

    I’m using the same blog platform as yours and I’m having
    problems finding one? Thanks a lot!

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注