Windows 2003上网络负载均衡的实现

以前一直研究的都是基于Linux/FreeBSD下的负载均衡架构,在我另外一篇负载均衡文章里面专门提到过相关的内容,今天无意中看到一篇文章谈到在window 2003 server上实现负载均衡,这还是第一次看到,实现的方式类似Linux的LVS软件方式,之前在Windows 2000和XP中都没有类似的功能,感觉挺有意思,搜集过来大家分享。

[原文如下]

在现行的许多网络应用中,有时一台服务器往往不能满足客户端的要求,此时只能通过增加服务器来解决问题。
  那么,有没有一个办法或者技术来解决此类问题呢?使用Windows 2000或Windows Server 2003中的网络负载平衡群集就可以(本文将介绍Windows Server 2003中的网络负载平衡技术的实现方法)。

  一、网络负载平衡的优点

  1.网络负载平衡允许你将传入的请求传播到最多达32台的服务器上,即可以使用最多32台服务器共同分担对外的网络请求服务。网络负载平衡技术保证即使是在负载很重的情况下它们也能作出快速响应。

  2.网络负载平衡对外只须提供一个IP地址(或域名)。

  3.如果网络负载平衡中的一台或几台服务器不可用时,服务不会中断。网络负载平衡自动检测到服务器不可用时,能够迅速在剩余的服务器中重新指派客户机通讯。此保护措施能够帮助你为关键的业务程序提供不中断的服务。可以根据网络访问量的增多来增加网络负载平衡服务器的数量。

  4.网络负载平衡可在普通的计算机上实现。

  在Windows Server 2003中,网络负载平衡的应用程序包括Internet信息服务(IIS)、ISA Server 2000防火墙与代理服务器、VPN虚拟专用网、终端服务器、Windows Media Services(Windows视频点播、视频广播)等服务。同时,网络负载平衡有助于改善你的服务器性能和可伸缩性,以满足不断增长的基于Internet客户端的需求。

  网络负载平衡可以让客户端用一个逻辑Internet名称和虚拟IP地址(又称群集IP地址)访问群集,同时保留每台计算机各自的名称。

  下面,我们将在两台安装Windows Server 2003的普通计算机上,介绍网络负载平衡的实现及应用。

这两台计算机中,一台计算机名称为w2003-1,IP地址为202.206.197.190,另一台名为w2003-2,IP地址为202.206.197.191。

  规划网络负载平衡群集使用的IP地址为202.206.197.195,规划网络负载平衡群集完整的计算机名称为cluster.heinfo.edu.cn。你需要在heinfo.edu.cn域中注册此主机名称并将地址设置为202.206.197.195。如果你没有DNS,可以在需要访问网络负载平衡的客户机(包括网络负载平衡主机)上编辑%systemroot%system32driversetc目录下的hosts文件,添加一条信息“202.206.197.195 cluster.heinfo.edu.cn”,即可解决DNS域名解析的问题。

  当正式应用时,客户机只需要使用cluster.heinfo.edu.cn或IP地址202.206.197.195来访问服务器,网络服务平衡会根据每台服务器的负载情况自动选择202.206.197.190或者202.206.197.191对外提供服务。

  网络负载平衡的实现过程如下:

  在实现网络负载平衡的每一台计算机上,只能安装TCP/IP协议,不要安装任何其他的协议(如IPX协议或者NetBEUI协议),在网络属性中,“网络负载平衡”也不能被选择,这可以从“网络连接属性”中查看。

  ①先进入第一台计算机,以管理员身份登录,从“管理工具”中运行“网络负载平衡管理器”,用鼠标右键单击“网络负载平衡群集”,从出现的菜单中选择“新建群集”,进入“群集参数”界面(图1)。

win2003_lvs1
图1

  在“IP地址”后面输入规划的群集参数地址202.206.197.195,在子网掩码处使用默认值,在“完整Internet名称”后面输入cluster.heinfo.edu.cn(也可以是其他的名称,但输入的DNS名称必须与输入的IP地址相符)。

  如果允许远程控制,请选中“允许远程控制”,并在“远程密码”和“确认密码”处输入可以进行远程控制的密码。
②点击“下一步”按钮,进入群集IP地址页面后再进入“端口规则”界面,点击“下一步”按钮,进入“连接”界面(图2)。

win2003_lvs2
图2

  ③在“连接”界面的“主机”栏中输入当前计算机的名称w2003-1,然后点击“连接”按钮,将在“对配置一个新的群集可用的接口”框中显示出连接的计算机的网卡及IP地址。选择与群集IP地址同一网段的地址(用于对外提供网络应用的网卡),然后点击“下一步”按钮,进入设置“主机参数”界面,点击“完成”按钮,系统将自动开始网络负载平衡群集的配置。几分钟后,网络负载平衡群集配置完成。

  ④打开第二台计算机,并以管理员的身份登录进入。

  注意:在网络负载平衡中的每个节点上,管理员账号的用户名和密码最好一致。

  ⑤然后,在第一台计算机上,用鼠标右键单击新创建的群集,从出现的菜单中选择“添加主机到群集”。将出现“连接”界面,在“主机”中输入第二台计算机的计算机名称,点击“连接”按钮,将会在“对配置群集可用的接口”下面显示出连接的计算机上的网络配置。选择202.206.197.191的网卡,进入主机参数界面,点击“完成”按钮,即可返回网络负载平衡管理器(图3)。

win2003_lvs3
图3

  ⑥关闭网络负载平衡管理器后再进入网络负载平衡管理器。用鼠标右键单击“网络负载平衡群集”,从出现的菜单中选择“连接到现存的”,将会弹出“连接”界面。

  输入第一台计算机的名称,点击“连接”按钮,在“群集”下面将列出群集的IP地址,选择此IP地址,并点击“完成”按钮,连接群集即可完成。

  以后,如果这两台服务器不能满足需求,可以按以上步骤添加第3台、第4台计算机到网络负载平衡中以满足要求。
三、用IIS服务验证网络负载平衡

  网络负载平衡配置好后,为了实现某项具体的服务,需要在网络负载平衡的计算机上安装相应的服务。例如:为了实现IIS网站的负载平衡,需要在相应的网络负载平衡的计算机上安装IIS服务。

  安装网络负载平衡的应用程序时,不需要特别的方法,只需要在配置好网络负载平衡的计算机上安装相应的服务即可。但是为了让每个用户在通过网络负载平衡访问到不同的计算机时,能够访问到一致的数据,需要在网络负载平衡的每台计算机上保持数据的一致性。举例来说:实现了两个节点的IIS的网络负载平衡,为了保证两个网站内容的一致性,除了这两个IIS服务器的配置相同外,相应的网站数据必须一致。

  为了检验网络负载平衡,我们可以通过IIS来进行验证,其他的一些应用如终端服务、Windows Media服务与IIS的应用相类似。

  在网络负载平衡的每一台计算机上安装IIS服务,方法如下:

  在“添加/删除程序”中,点击“添加Windows组件”,进入Windows组件向导,双击“应用程序服务器”,进入“应用程序服务器”(图4)。

win2003_lvs4
图4

  选中ASP.NET、Internet信息服务及应用网络COM+访问后,即可开始安装IIS服务。

  安装之后,进入第一台计算机的inetpubwwwroot目录,新建一个文本文件,输入以下内容:

  
  This win2003-1
  

  然后将它保存为default.htm文件。这个网页在IE中将显示如下内容:

  This w2003-1

  在第二台计算机的inetpubwwwroot目录,新建一个文本文件,并输入下面的内容:

  
  This win2003-2
  

  这个网页在IE浏览器中将显示“This w2003-2”,随后将这个文件以default.htm名称保存。

  然后,在其他计算机上的IE浏览器中键入http//cluster.heinfo.edu.cn,将会显示为“This win2003-1”或“This win2003-2”,根据网络的负载,网络负载平衡会自动转发到第一台计算机或第二台计算机。为了验证效果,你可以在浏览的时候,拔掉第一台计算机的网线或拔掉第二台机器的网线,将会发现浏览到的将是不同内容。当然,我们只是测试的时候,为了验证网络负载平衡的效果,两个网站的内容不一致,而在正式应用的时候,网络负载平衡群集的每个节点计算机的内容将是一致的,这样,不管使用那一个节点响应,都保证访问的内容是一致的。

1 thought on “Windows 2003上网络负载均衡的实现”

  1. Pingback: Your Domain Name
  2. Howdy I am so delighted I found your blog page, I really found
    you by accident, while I was browsing on Bing for something else, Regardless
    I am here now and would just like to say thanks for a incredible post and
    a all round interesting blog (I also love the theme/design),
    I don’t have time to browse it all at the minute but I have saved it and also included
    your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the superb job.

  3. Greetings I am so grateful I found your website, I really found you by error,
    while I was looking on Google for something else, Regardless I
    am here now and would just like to say thanks a lot for a
    tremendous post and a all round interesting blog (I also love the theme/design), I don’t have time to read
    through it all at the minute but I have book-marked it and also
    included your RSS feeds, so when I have time I will be back to
    read more, Please do keep up the excellent work.

  4. I together with my buddies happened to be following the best thoughts from your web blog and so instantly I had an awful suspicion I had not thanked the site owner for those secrets. The ladies ended up as a consequence joyful to study them and have in effect absolutely been tapping into these things. Many thanks for actually being simply thoughtful and also for considering such great subject matter most people are really eager to discover. My very own sincere apologies for not expressing appreciation to you earlier.

  5. I wanted to compose a quick remark so as to thank you for those wonderful pointers you are sharing here. My time intensive internet research has at the end of the day been paid with pleasant information to write about with my co-workers. I would repeat that we visitors are very fortunate to live in a magnificent place with very many awesome individuals with very beneficial secrets. I feel somewhat happy to have discovered your entire web site and look forward to so many more fun times reading here. Thank you once again for everything.

  6. I simply needed to thank you so much again. I do not know the things I would’ve accomplished in the absence of these creative ideas shown by you directly on that problem. It was before a very depressing case in my view, however , considering a new specialised form you resolved that forced me to weep over contentment. I am grateful for this service as well as have high hopes you recognize what a great job you are always accomplishing educating the mediocre ones by way of your webpage. I am certain you have never met any of us.

  7. Thank you so much for giving everyone an extremely splendid possiblity to read in detail from this blog. It really is so beneficial and as well , stuffed with fun for me personally and my office colleagues to search your site at minimum three times in one week to see the new guides you have. And of course, I am at all times pleased with the sensational pointers you give. Selected two tips on this page are undoubtedly the most beneficial we have all ever had.

  8. I needed to write you the little bit of observation so as to give thanks yet again on the precious concepts you have featured at this time. It is really remarkably open-handed of people like you in giving easily just what many individuals would have supplied for an ebook to help make some profit on their own, notably since you might have tried it in case you decided. The principles in addition acted to provide a good way to fully grasp some people have the same dream the same as mine to figure out somewhat more with reference to this condition. I believe there are lots of more pleasant periods in the future for folks who view your website.

  9. I’ve been browsing online more than three hours as of late, yet I never
    found any interesting article like yours. It’s
    lovely worth sufficient for me. In my opinion, if all webmasters and bloggers made excellent content material as you probably did, the web will probably be a lot more useful than ever before.

  10. Pingback: nike air max
  11. Pingback: yeezy boost 350
  12. Pingback: jordan shoes
  13. Pingback: jordan retro
  14. Pingback: ultra boost 3.0
  15. Pingback: nike air max
  16. Pingback: cheap jordans
  17. Pingback: jordan shoes
  18. Pingback: yeezy shoes
  19. Pingback: jordan shoes
  20. Pingback: air max 2018
  21. Pingback: yeezy boost 350
  22. Pingback: fila shoes
  23. Pingback: adidas zx flux
  24. Pingback: cheap jordans
  25. Pingback: jordan shoes
  26. Pingback: adidas superstars
  27. Pingback: coach outlet
  28. Pingback: louboutin outlet
  29. Pingback: nike air max 2017
  30. Pingback: birkin bag
  31. Pingback: canada goose
  32. Pingback: jordan shoes
  33. Pingback: yeezy 700
  34. Pingback: nike air max 97
  35. Pingback: nhl jerseys
  36. Pingback: yeezy boost 350
  37. Pingback: polo ralph lauren
  38. Pingback: yeezy shoes
  39. Pingback: balenciaga shoes
  40. Pingback: supreme outlet
  41. Pingback: curry shoes
  42. Pingback: hermes online
  43. Pingback: moncler
  44. Pingback: hermes birkin bag
  45. Superb website you have here but I was curious about if you knew of any community forums that cover the same topics talked about here?
    I’d really love to be a part of group where I can get advice from other experienced
    people that share the same interest. If you have any suggestions,
    please let me know. Thanks!

  46. Pingback: balenciaga speed
  47. Pingback: balenciaga
  48. Pingback: hermes belt
  49. Pingback: adidas nmd r1
  50. Pingback: jordan shoes
  51. Pingback: calvin klein
  52. First off I want to say awesome blog! I had a quick question that I’d like to ask if you
    don’t mind. I was curious to find out how you center yourself and clear your head prior
    to writing. I have had trouble clearing my thoughts in getting my ideas out there.
    I do take pleasure in writing however it just seems like the first 10 to 15 minutes are wasted just trying to figure out how to begin. Any ideas or tips?
    Thank you!

  53. Pingback: moncler jackets
  54. Pingback: lebron 17 shoes
  55. Pingback: nike air max
  56. Pingback: kobe sneakers
  57. Pingback: nike air max
  58. Pingback: nike off whtie
  59. Pingback: goyard wallet
  60. Pingback: curry 5 shoes

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image