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,417 条回应

  1. What’s up, yeah this piece of writing is in fact nice and I have learned lot of things from it about blogging.
    thanks.

    回复
  2. I truly love your blog.. Excellent colors & theme.

    Did you make this web site yourself? Please reply back as I’m hoping to create my own site and would like to know where you
    got this from or just what the theme is named. Kudos!

    回复
  3. I think that everything posted made a great deal of sense.
    However, think on this, what if you were to create
    a awesome headline? I ain’t saying your content is not solid.,
    however suppose you added a title that grabbed people’s attention?
    I mean 【转载】WINDOWS2008网络负载平衡群集(NLB)完全攻略 – LSX-blog is
    kinda boring. You might peek at Yahoo’s front page and see how they write article titles to get
    viewers interested. You might add a related video or a picture or two to get
    readers excited about what you’ve got to say.
    In my opinion, it might bring your posts a little livelier.

    回复
  4. Do you have any video of that? I’d love to find
    out some additional information.

    回复
  5. This design is wicked! You obviously know how to keep a reader entertained.

    Between your wit and your videos, I was almost moved
    to start my own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more
    than that, how you presented it. Too cool!

    回复
  6. Painter And Decorator Gloucester
    38 Bruton Way
    Gloucester GL1 1DA, United Kingdom
    01452 223268

    回复
  7. I’m not sure where you are getting your info, but good topic.

    I needs to spend some time learning more or understanding more.
    Thanks for magnificent info I was looking for this info for my mission.

    回复
  8. This site really has all of the information I wanted concerning this subject and didn’t know who to ask.

    回复
  9. Why people still make use of to read news papers when in this technological world all is existing on web?

    回复
  10. I know this site gives quality based content and additional material, is there
    any other site which provides such stuff in quality?

    回复
  11. Attractive element of content. I simply stumbled upon your weblog and in accession capital to claim that I get in fact enjoyed account your weblog posts.
    Anyway I’ll be subscribing to your feeds and even I fulfillment you get
    right of entry to persistently rapidly.

    回复
  12. Hey there! Quick question that’s totally off topic. Do you know how to
    make your site mobile friendly? My blog looks weird when browsing from my iphone.
    I’m trying to find a template or plugin that might be able to resolve this
    problem. If you have any recommendations, please share. With thanks!

    回复
  13. Excellent site you’ve got here.. It’s hard
    to find high quality writing like yours nowadays.
    I really appreciate individuals like you! Take care!!

    回复
  14. Sur Internet, des websites sérieux proposent des compléments alimentaires
    de grande qualité.

    回复
  15. It’s awesome in support of me to have a web page, which is good designed for my experience.
    thanks admin

    回复
  16. It’s awesome to pay a visit this web page and reading the
    views of all colleagues about this piece of writing, while I
    am also keen of getting know-how.

    回复
  17. Ils ont parfois un intérêt préventif comme le montrent différentes études
    épidémiologiques et expérimentales.

    回复
  18. Hello friends, how is all, and what you desire to say on the topic of this article, in my view its genuinely amazing designed
    for me.

    回复
  19. I know this website offers quality depending posts and additional material, is
    there any other website which provides these kinds of stuff in quality?

    回复
  20. Hi all, here every person is sharing such experience, therefore it’s fastidious to read this
    blog, and I used to pay a visit this blog every
    day.

    回复
  21. Hello to all, how is all, I think every one
    is getting more from this web site, and your views are nice in favor of new
    visitors.

    回复
  22. obviously like your web-site but you have to check the spelling on quite a few of your posts.
    A number of them are rife with spelling problems and I in finding it very troublesome to inform the
    reality however I’ll certainly come back again.

    回复
  23. What i do not realize is in reality how you’re now not really a
    lot more well-preferred than you might be now. You’re very intelligent.

    You recognize therefore considerably in the case of this matter, produced me for my part believe it from
    so many various angles. Its like men and women are not fascinated unless
    it is something to accomplish with Lady gaga! Your
    individual stuffs excellent. All the time deal with it up!

    回复
  24. Tremendous things here. I’m very glad to peer your
    post. Thanks so much and I am looking ahead to touch
    you. Will you please drop me a mail?

    回复
  25. Hi there, this weekend is pleasant designed for me, as this occasion i am
    reading this great educational article here at my house.

    回复
  26. Pea protein maximizes muscle retention while helping
    you to cut calories towards the minimum. Weight loss is directly linked to eliminating body waste so the need for hydration is basically high.
    That’s why we say were burning calories when we have been physically
    active or while we’re sleeping.

    回复
  27. My brother suggested I might like this web site. He was totally right.
    This submit actually made my day. You cann’t consider simply how a lot time I had spent for this information!
    Thanks!

    回复
  28. Word – Press is not hard to make use of so just about anybody can set it up with a few clicks.
    As Word – Press is often a database driven cms, which means you don’t have to
    change anything while doing modifications in the template.

    Once there you are able to select the theme that you want for your Word – Press blog.

    回复
  29. Spot on with this write-up, I truly believe this
    site needs much more attention. I’ll probably be back again to read more, thanks
    for the advice!

    回复
  30. Hello there! I could have sworn I’ve been to this site before but
    after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely glad I found it and I’ll
    be bookmarking and checking back frequently!

    回复
  31. 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 me from that service? Cheers!

    回复
  32. My family members all the time say that I am
    wasting my time here at net, except I know I am getting know-how daily
    by reading thes pleasant articles or reviews.

    回复
  33. I really like what you guys tend to be up too. Such clever work and
    reporting! Keep up the awesome works guys I’ve incorporated you guys to our blogroll.

    回复
  34. Excellent weblog here! Additionally your website rather a lot up very fast!
    What web host are you using? Can I am getting your affiliate link in your host?
    I want my website loaded up as fast as yours lol

    回复
  35. You’re so awesome! I don’t believe I’ve truly read through anything like this before.
    So wonderful to discover another person with a few original thoughts on this topic.
    Really.. many thanks for starting this up. This site is something that’s
    needed on the web, someone with a little originality!

    回复
  36. Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old
    daughter and said “You can hear the ocean if you put this to your ear.” She placed
    the shell to her ear and screamed. There was a hermit crab inside and
    it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but
    I had to tell someone!

    回复
  37. I love what you guys are up too. This kind of clever work and coverage!
    Keep up the fantastic works guys I’ve added you guys to my blogroll.

    回复
  38. Pretty! This was an incredibly wonderful post.
    Thanks for providing these details.

    回复
  39. Hi! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work due to no data backup.
    Do you have any solutions to prevent hackers?

    回复
  40. Hi colleagues, how is everything, and what you desire to say about this paragraph,
    in my view its truly remarkable in favor of me.

    回复
  41. Definitely believe that which you stated. Your favorite reason seemed
    to be on the web the easiest thing to be aware of. I say to you, I definitely
    get annoyed while people think about worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined
    out the whole thing without having side-effects , people can take
    a signal. Will probably be back to get more. Thanks

    回复
  42. Fantastic site you have here but I was curious about if you knew
    of any message boards that cover the same topics
    talked about here? I’d really love to be a part of online community where I can get comments from other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know. Thanks a lot!

    回复
  43. An interеsting diѕcussion is definitely wοrth comment.
    I do think that ʏou neeԁ to publish more on tһiѕ issue, it might not be a taboo matter but tyρicalⅼy peoplе don’t speak aЬout these topісs.
    T᧐ the neхt! Kind regards!!

    回复
  44. Hello, the whole thing is going well here and ofcourse every one is sharing information, that’s
    really excellent, keep up writing.

    回复
  45. Hey very nice web site!! Man .. Excellent ..

    Wonderful .. I will bookmark your website and take the feeds also?
    I am glad to find so many useful information right here in the post, we’d like develop extra techniques
    on this regard, thank you for sharing. . . . . .

    回复
  46. Very nice post. I just stumbled upon your weblog and wanted to say that I have truly enjoyed surfing around
    your blog posts. In any case I’ll be subscribing to your rss feed and I
    hope you write again very soon!

    回复
  47. My spouse and I stumbled over here coming from a different page and thought I
    may as well check things out. I like what I see so i
    am just following you. Look forward to checking out your web page yet
    again.

    回复
  48. I like the helpful info you provide in your articles.

    I’ll bookmark your blog and check again here regularly.

    I’m quite sure I’ll learn many new stuff right here!
    Good luck for the next!

    回复

发表评论

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