Building a Windows Server 2008 Network Load Balancing Cluster
Windows Server 2008 supports both Network Load Balancing (NLB) and Failover clustering. This chapter covers Network Load Balancing clustering. The topic of Failover clustering is covered in detail in the chapter entitled Building a Windows Server 2008 Failover Cluster.
An Overview of Network Load Balancing Clusters
Network Load balancing provides failover and high scalability for Internet Protocol (IP) based services providing support for Transmission Control Protocol (TCP), User Datagram Protocol (UDP) and general Routing Encapsulation (GRE) traffic. Each server in a cluster is referred to as a node. Network Load Balance Clustering is supported by all versions of Windows Server 2008 with support for clusters containing 2 up to a maximum of 32 nodes.
Network Load Balancing assigns a virtual IP address to the cluster. When a client request arrives at the cluster this virtual IP address is mapped to the real address of a specific node in the cluster based on configuration settings and server availability. When a server fails, traffic is diverted to another server in the cluster. When the failed node is brought back online it is then re-assigned a share of the load. From a user perspective the load balanced cluster appears to to all intents and purposes as a single server represented by the virtual Ip address.
The failure of a node in a cluster is detected by the transmission of heartbeats by each node. If a node fails to transmit a heartbeat for a designated period of time that node is assumed to have failed and the remaining nodes takeover the work load of the failed server.
Nodes in a Network Load Balanced cluster typically do not share data, instead each storing a local copy of data. Under such a scenario the cluster is referred to as a farm. This approach is ideal for load balancing of web servers where the same static web site data is stored on each node. In an alternative configuring, referred to as a pack the nodes in the cluster all access shared data. In this scenario the data is partitioned such that each node in the cluster is responsible for accessing different parts of the shared data. This is commonly used with database servers, with each node having access to different parts of the database data with no overlap (a concept also known as shared nothing).
Network Load Balancing Models
Windows Server 2008 Network Load Balancing clustering can be configured using either one or two network adapters, although for maximum performance two adapters are recommended. In such a configuration one adapter is used for communication between cluster nodes (the cluster adaptor) and the other for communication with the outside network (the dedicated adapter).
The four basic Network Load Balancing modes are as follows:
- Unicast with Single Network Adapter - MAC address of network adapter is disabled and cluster MAC address is used. Traffic is received by all nodes in the cluster and filtered by NLB driver. Nodes in the cluster are able to communicate with addresses outside the cluster subnet but node to node communication within cluster subnet is not possible.
- Unicast with Multiple Network Adapters - MAC address of network adapter is disabled and cluster MAC address is used. Traffic is received by all nodes in the cluster and filtered by NLB driver. Nodes within the cluster are able to communicate with each other within the cluster subnet and also with addresses outside the subnet.
- Multicast with Single Network Adapters - Both network adapter and cluster MAC addresses are enabled. Nodes within the cluster are able to communicate with each other within the cluster subnet and also with addresses outside the subnet. Not recommended for significant levels of traffic are directed to specific cluster nodes.
- Multicast with Multiple Network Adapters - Both network adapter and cluster MAC addresses are enabled. Nodes within the cluster are able to communicate with each other within the cluster subnet and also with addresses outside the subnet. This is the ideal configuration for environments where there are significant levels of traffic directed to specific cluster nodes.
Configuring Port and Client Affinity
Network traffic arrives on one of a number of different ports (for example FTP traffic uses ports 20 and 21 while HTTP traffic uses port 80). Network Load Balancing may be configured on a port by port basis or range of ports. For each port three options are available to control the forwarding of the traffic:
- Single Host - Traffic to the designated port is forward to a singe node in the cluster.
- Multiple Hosts - Traffic to the designated port is distributed between the nodes in the cluster.
- Disabled - No filtering is performed.
Many client/server communications take place within a session. As such the server application will typically maintain some form of session sate during the client server transaction. Whilst this is not a problem in the case of a Single Host configuration described above, clearly problems may arise if a client is diverted to a different cluster node partway through a session since the new server will not have access to the session state. Windows Server 2008 Network Load Balancing addresses this issue by providing a number of client affinity configuration options. Client affinity involves the tracking of both destination port and source IP address information to optionally ensure that all traffic to a specific port from a client is directed to the same server in the cluster. The available Client affinity settings are as follows:
- Single - Requests from a single source IP address are directed to the same cluster node.
- Network - Requests originating from within the same Class C network address range are directed to the same cluster node.
- None - No client affinity. Requests are directed to nodes regardless of previous assignments.
Installing the Network Load Balancing Feature
The first step in building a load balanced cluster is to install the Network Load Balancing feature on each server which is to become a member of the cluster. This can be achieved by starting the Server Manager tool, selecting Features from the left panel and then clicking on the Add Features link. In the list of available features, select Network Load Balancing and click on Next followed by Install.
Network Load Balancing may also be installed from a command prompt with elevated privileges (right click on the command prompt in the Start menu and select Run as administrator) by running the servermanagercmd -install nlb command. For example:
C:\Windows\system32>servermanagercmd -install nlb ...... Start Installation... [Installation] Succeeded: [Network Load Balancing]. <100/100> Success: Installation succeeded.
Once installation is complete both the graphical Network Load Balancing Manager and the command line NLB CLuster Control Utility (nlbmgr.exe and nlb.exe respectively) will be installed ready for use.
Building a Windows Server 2008 Network Load Balanced Cluster
Network Load Balanced clusters are build using the Network Load Balancing Manager which may be launched from the Start -> All Programs -> Administrative Tools menu or from a command prompt running nlbmgr. Once loaded, the manager will appear as shown in the following figure:
To pre-configure the account and password credentials to be used on each host when working with the cluster select Options -> Credentials and enter an account and password. Note that the account must be a member of the administrators group. If default credentials are copnfigured the user will be prompted for account and password information each time a connection to a cluster node is established.
To begin the cluster creation process right click on the Network Load Balancing Clusters entry in the left panel of the manager window and select the New Cluster menu option. This will display New Cluster connection dialog. In this dialog, enter either the name or IP address of the first server to be included in the load balanced cluster and press the Connect button to establish a connection to that server. If the connection is successful to the first server will be listed:
Clicking Next will display a warning that DHCP will be turned off the the network adapter of the specified host that any necessary gateway information will need to be configured manually using the server's network properties dialog. Subsequently the Host Parameters screen will appear as shown below:
The Priority (unique host ID) is a number between 1 and 32 and serves two purposes. Firstly, the number provides a unique ID within the cluster to distinguish the server from other nodes. Secondly, it specifies the priority order of the cluster. The cluster node with the lowest priority is assigned to handle all traffic that is not covered by a port rule. All servers joining a cluster must have a unique ID. I new server attempting to join a cluster with a conflicting ID will be denied.
The Dedicated IP addresses fields are used when a single network adapter is used for both communication between cluster nodes and external network traffic. It is used to specify the host's unique IP address, which is used for non-cluster network traffic (i.e direct connections to the specific server from outside the cluster without being affected by the Network Load Balancing). This must be a fixed IP address and not a DHCP address and as such should also be entered into the network properties dialog of the server. To configure dedicated IP addresses, click on the Add... button and enter the IP address and subnet mask (for example 255.255.255.0).