Implementing a highly available deployment of a Web site with an NLB cluster
In front of the blog post and friends chat about how to build a Web site, then today and everyone talk about how to achieve high availability of the Web site.
In this article we use NLB to explain how to achieve high availability of Web sites:
Introduction to NLB:
Network Load Balancing cluster (NLB), which prevents a single node failure when it is in effect, and its deployment requires at least two servers, the role of NLB is that when one node in the cluster fails or stops working, its running service automatically switches to another host in the cluster, and of course, like our other clusters, When there is too much traffic, the NLB cluster automatically implements the network load and prevents the load from being uneven, thus enabling the service to function properly.
Attention:
Network Load Balancing does not provide additional security for a load-carrying host, nor can it be used for firewalls, so it is important to properly protect load-balanced applications and hosts. If possible, use at least two network adapters on each cluster host, but not a requirement, use only the TCP/IP protocol on the cluster adapter, ensure that all hosts in the cluster belong to the same subnet and that the client has access to the subnet, configure the NLB cluster with Network Load Balancing Manager, enable logging, Do not enable remote control of Network Load Balancing, in addition, you should use NLB clusters and server clusters independently.
Experimental background:
The company has a Web site, due to the increasing number of customer visits, Web site response more and more slowly. The company decided to use two Web servers for customer access, both of which provide the same Web content and use Network Load Balancing clustering technology to determine which server the client specifically accesses, based on the load of each server. Configure two computers in a cluster in a Windows domain.
Lab Environment:
Install three Windows Server R2 virtual machines in our VMware Workstation, each as a domain-controlled, member-server.
Here is a topological diagram of our experiment:
650) this.width=650; "height=" 484 "title=" clip_image002 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwthrzpfrwaacmjtmahm0079.jpg "border=" 0 "/>
The IP address plan is as follows:
Host Name |
Operating system |
IP Address |
Dns |
Cluster address |
DC |
Windows Server R2 |
192.168.1.1 |
192.168.1.1 |
|
NWEB01 |
Windows Server R2 |
public:192.168.1.2 hart:172.16.1.1 |
192.168.1.1 |
192.168.1.10 |
NWEB02 |
Windows Server R2 |
public:192.168.1.3 hart:172.16.1.2 |
192.168.1.1 |
Install and configure the NLB cluster installation Network Load Balancing feature
First we need to install the Network Load Balancing feature on our two Web servers, with the following installation methods:
First we open the NWEB01 Server Manager:
650) this.width=650; "height=" 332 "title=" clip_image004 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwthui2d1eaaeyehcaupm785.jpg "border=" 0 "/>
Click Add Roles and Features:
650) this.width=650; "height=" 457 "title=" clip_image006 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image006 "src=" http://s3.51cto.com/wyfs02/M02/6D/FB/ Wkiol1vwthiwmhyvaafhnz4ov-4471.jpg "border=" 0 "/>
The system pops up the Add Roles and Features Wizard, where you directly click Next:
650) this.width=650; "height=" 459 "title=" clip_image008 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image008 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwthnqg2yqaaecx4kpssw970.jpg "border=" 0 "/>
Installation type location Select the role or feature-based installation and click Next:
650) this.width=650; "height=" 458 "title=" clip_image010 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image010 "src=" http://s3.51cto.com/wyfs02/M01/6D/FB/ Wkiol1vwthnwhbvqaagooirzdwm513.jpg "border=" 0 "/>
Choose the server from the server pool here and determine the hostname and IP address no problem, click Next:
650) this.width=650; "height=" 459 "title=" clip_image012 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image012 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwthrijqppaagcoqiw518558.jpg "border=" 0 "/>
Check Network Load Balancing here:
650) this.width=650; "height=" 457 "title=" clip_image014 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image014 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwth3y1apdaafjqinxjlm241.jpg "border=" 0 "/>
Click Add Features:
650) this.width=650; "height=" 458 "title=" clip_image016 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image016 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwth7bek51aagpxnfrd9c187.jpg "border=" 0 "/>
After you have determined that Network Load Balancing has been ticked, click Next:
650) this.width=650; "height=" 457 "title=" clip_image018 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image018 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwth7syivdaaezwgtnahq219.jpg "border=" 0 "/>
Click Install:
650) this.width=650; "height=" 457 "title=" clip_image020 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image020 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwth-w7dofaaeehnsqagg824.jpg "border=" 0 "/>
Installation is successful, click Close.
In NWEB2 also need to install Network Load Balancing, the steps are the same as NWEB01, where I do not do demo.
Configuring the NLB Cluster
After the installation is complete, open NWEB01 Server Manager:
650) this.width=650; "height=" 301 "title=" clip_image022 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image022 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwth-qjsx-aae6c_gd7wq894.jpg "border=" 0 "/>
Click Tools----Network Load Balancing Manager:
650) this.width=650; "height=" 333 "title=" clip_image024 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image024 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwth-z3xlkaac28-hxnd8056.jpg "border=" 0 "/>
Right-click Network Load Balancing Manager:
650) this.width=650; "height=" 331 "title=" clip_image026 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image026 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwtictombzaac7v4sal_g142.jpg "border=" 0 "/>
New cluster:
650) this.width=650; "height=" 484 "title=" clip_image027 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image027 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwtidjb8hkaadx5sxg7-a432.jpg "border=" 0 "/>
Enter the IP address of the first server in the cluster here, click Connect:
650) this.width=650; "height=" 484 "title=" clip_image028 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image028 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwtidq3yl0aadzelmz9ig181.jpg "border=" 0 "/>
As you can see, here you need to select an IP address that can be used to configure the new interface for the cluster, where I select the public network card and click Next:
650) this.width=650; "height=" 484 "title=" clip_image029 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image029 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwtihyy_upaaectvqn7no966.jpg "border=" 0 "/>
Because this is the first server in the cluster, to determine that its priority is 1 and to determine its IP address is correct, click Next:
650) this.width=650; "height=" 484 "title=" clip_image031 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image031 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwtihquxfqaadnj8mtmm0634.jpg "border=" 0 "/>
Here you need to set an IP address for the cluster and click Add:
650) this.width=650; "height=" 484 "title=" clip_image032 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image032 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwtigg8ovdaafxr74qoku671.jpg "border=" 0 "/>
According to our previous plan, here I use 192.168.1.10来 as the IP address of the NLB cluster, click OK:
650) this.width=650; "height=" 484 "title=" clip_image033 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image033 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwtilscquiaad_uiavalo106.jpg "border=" 0 "/>
After you have identified the cluster IP address, click Next:
650) this.width=650; "height=" 484 "title=" clip_image034 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image034 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwth-zzxataad14ba1z7q818.jpg "border=" 0 "/>
You need to enter the full Internet name here, because the URL of the website I want to create below is www.contoso.com so here I use www.contoso.com click Next:
650) this.width=650; "height=" 484 "title=" clip_image035 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image035 "src=" http://s3.51cto.com/wyfs02/M01/6D/FB/ Wkiol1vwticibraiaaeshycr-to902.jpg "border=" 0 "/>
Leave the default here and click Done:
650) this.width=650; "height=" 331 "title=" clip_image037 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image037 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwtiobvnrvaaeb6ouprvm624.jpg "border=" 0 "/>
See the word "aggregated" in the status bar to prove our operation succeeded. Let's add a second host for the cluster:
right mouse button www.contoso.com:
650) this.width=650; "height=" 331 "title=" clip_image039 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image039 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwtisjnwgfaaeepp1l-zs817.jpg "border=" 0 "/>
Click Add Host to cluster:
650) this.width=650; "height=" 484 "title=" clip_image040 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image040 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwtitymrjfaadjp-7vhuc214.jpg "border=" 0 "/>
After we enter the IP address of the host to be added, click Connect:
650) this.width=650; "height=" 484 "title=" clip_image041 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image041 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwtittoja5aadx79-ur9e585.jpg "border=" 0 "/>
Select our public network card here and click Next:
650) this.width=650; "height=" 484 "title=" clip_image042 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image042 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwtiwzewpnaaeblmnj_uq228.jpg "border=" 0 "/>
Note that since this is the second host within the cluster, its priority should be 2 and click Next:
650) this.width=650; "height=" 484 "title=" clip_image043 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image043 "src=" http://s3.51cto.com/wyfs02/M02/6D/FB/ Wkiol1vwtilijzt2aaepzazusmc671.jpg "border=" 0 "/>
Here to keep the default, click Done:
650) this.width=650; "height=" 332 "title=" clip_image045 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image045 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwtilcj6qwaae2lkitenc535.jpg "border=" 0 "/>
Seeing that both hosts are aggregated and prioritized without problems proves that our NLB cluster is configured successfully.
Test the NLB Cluster
To open the Run command on a domain controller, run the command:
Ping 192.168.1.10–t
650) this.width=650; "height=" 424 "title=" clip_image047 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image047 "src=" http://s3.51cto.com/wyfs02/M01/6D/FB/ Wkiol1vwtiprf1mdaafoiknvmk8321.jpg "border=" 0 "/>
OK, you can see can ping, below we disable a host network card:
650) this.width=650; "height=" 310 "title=" clip_image049 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image049 "src=" http://s3.51cto.com/wyfs02/M02/6D/FB/ Wkiol1vwtioqxvdbaac04iig15c210.jpg "border=" 0 "/>
Then go back to our domain controller:
650) this.width=650; "height=" 422 "title=" clip_image051 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image051 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwtisskjfkaalcno24k1g081.jpg "border=" 0 "/>
You can see that our ping command has not been interrupted to prove that our NLB cluster is configured successfully!
Enabling high availability of Web sites
In the previous experiment we have successfully created the NLB cluster, and we will use the NLB cluster to implement a highly available deployment of the Web site:
First we create a shared folder on the domain controller:
650) this.width=650; "height=" 289 "title=" clip_image053 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image053 "src=" http://s3.51cto.com/wyfs02/M01/6D/FB/ Wkiol1vwtisrhenhaaerspivhq8979.jpg "border=" 0 "/>
Create a Default.htm file within the shared folder:
650) this.width=650; "height=" 143 "title=" clip_image055 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image055 "src=" http://s3.51cto.com/wyfs02/M00/6D/FF/ Wkiom1vwtiewtlzvaactq51ysqy206.jpg "border=" 0 "/>
OK, let's Open the IIS Manager for NWEB01:
650) this.width=650; "height=" 331 "title=" clip_image057 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image057 "src=" http://s3.51cto.com/wyfs02/M02/6D/FB/ Wkiol1vwtitshuhiaafxkfiia6q913.jpg "border=" 0 "/>
right mouse button URL, click Add URL:
650) this.width=650; "height=" 484 "title=" clip_image059 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image059 "src=" http://s3.51cto.com/wyfs02/M00/6D/FB/ Wkiol1vwtixsvnlvaaegr4znksa849.jpg "border=" 0 "/>
Note that the physical path here to select the location of our shared folder, IP address to specify the IP address of the NLB cluster, click OK:
650) this.width=650; "height=" "title=" clip_image061 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image061 "src=" http://s3.51cto.com/wyfs02/M01/6D/FB/ Wkiol1vwtixtt07kaafhakwog78005.jpg "border=" 0 "/>
Determine IP address and path no problem we open NWEB2 IIS Manager:
650) this.width=650; "height=" 333 "title=" clip_image063 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image063 "src=" http://s3.51cto.com/wyfs02/M02/6D/FB/ Wkiol1vwtiwsno20aaeokgfe9ke374.jpg "border=" 0 "/>
right mouse button URL, click Add URL:
650) this.width=650; "height=" 484 "title=" clip_image065 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image065 "src=" http://s3.51cto.com/wyfs02/M01/6D/FF/ Wkiom1vwti-ipe_gaaecuztuosy329.jpg "border=" 0 "/>
Note that the physical path here to select the location of our shared folder, IP address to specify the IP address of the NLB cluster, click OK:
650) this.width=650; "height=" 391 "title=" clip_image067 "style=" border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none, "alt=" clip_image067 "src=" http://s3.51cto.com/wyfs02/M02/6D/FF/ Wkiom1vwtjlqs9jxaagifdps-tc464.jpg "border=" 0 "/>
Make sure the IP address is not a problem our configuration is over.
Ok here is the end of our configuration!
This article from "Mr, Wu's Microsoft Blog" blog, reproduced please contact the author!
Implementing a highly available deployment of a Web site with an NLB cluster