Introduction to Microsoft Cluster Services (MSCs) in Windows .NET Server 2003
Mohan Rao Cavalemicrosoft Corporation In November 2002 Suitable for: Microsoft® Windows® .NET Server 2003 Enterprise Edition Microsoft Windows .NET Server 2003 DataCenter Edition Microsoft Cluster Services Summary: Learn how to easily perform performance checks for applications in a cluster environment without Change the application code. This article emphasizes one of three Microsoft server technologies that support clusters: cluster services. This article contains the screen of the English. table of Contents
Introduction Three clustering technology Implemented the fault transfer function of Microsoft Cluster Services Cluster Service Architecture Cluster Unrelated Application High Availability Notepad Summary Inventory In any case, only high quality applications with rich functional sets are not enough, In the case of it, it must also meet high availability conditions. Whether you are too high due to cluster technology, it is difficult to understand and use without upgrading the application? With the event of Microsoft® Cluster Services (introduced in Windows® NTTM 4, the developers can use some simple tools to deploy applications in the cluster environment in Windows® NTTM 4 in Windows® NTTM 4 in Windows® NTTM 4. These tools can register the application in the cluster as a general application and can control the configuration of the application with the Windows script. The cluster connects two or more servers to make them rendering the client as a single computer. Connect the server to a cluster to share the load, enable single-point operation / management, and provide a channel to meet the growing demand. Therefore, high availability applications can be generated by clustering. This article emphasizes one of three Microsoft server technologies that support clusters: cluster services. We will show how to easily perform performance checks for applications in a cluster environment without changing application code. Three cluster technology Microsoft servers provide three technologies that support clusters: Network Load Balancing (NLB), Component Load Balance (CLB), and Microsoft Cluster Services (MSCs). Network Load Balancing Network Load Balancing acts as a front-end cluster, is ideal for incremental scalability and significant availability for an e-commerce web site in the server cluster. You can share up to 32 Windows .NET Enterprise Server together share a virtual IP address. NLB has enhanced scalability by assigning client requests between multiple servers within the cluster. As traffic increases, you can add more servers to the cluster, and any cluster can accommodate up to 32 servers. NLB also provides high availability while providing users, that is, automatically detects server failures, and reassigns client traffic in the remaining servers within 10 seconds. Component Load Balancing Components Load Balancing can allocate a load between multiple running site business logic. It provides a dynamic balance of COM components in a server set that contains eight equivalent servers. In the CLB, the COM component is located on a separate COM cluster. The call to activate the COM component is the load of different servers to the COM cluster. The CLB works with NLB and cluster services with NLB and cluster services in an intermediate layer that acts on multi-layer cluster networks. The CLB is provided as a function of Application Center 2000 that can be run with the Microsoft cluster service in the same set of computers. The cluster service cluster service acts as a rear end cluster that provides high availability for applications such as databases, messages, and documents and print services. When removing a node (server in the cluster) fails or offline, MSCS will attempt to minimize the impact of faults on the system. Figure 1: Three Microsoft Server Technology implemented by Microsoft Cluster Servers The MSCS failover function is implemented by redundant implementations in multiple computers connected in a cluster, each computer has an independent fault state. Redundancy requirements Install the application on multiple computers in the cluster. However, the application is only in a online state at one node. This application will restart on another node when the application fails or when the server is shut down. Windows .NET Server 2003 DataCenter Edition supports up to 8 nodes in a cluster.
Each node has its own memory, system disk, operating system, and cluster resource subset. If a node fails, another node will take over the resource of the fault node (this process is called "failover"). The Microsoft Cluster Services will then register the network address of the resource on the new node to route the client traffic to the available system currently owned by the resource. When the fault resource is restored online, the MSCS can be configured to properly reassign the resource and client request (this process is called "fault reply"). To restore the application to the point when the failover occurs, the node must be able to access shared memory that hold the application status. Note that Microsoft Cluster services are designed to provide high availability, not true fault tolerance. The word "fault tolerance" is usually used to describe techniques for providing higher level recovery functions. Fault tolerant servers typically use advanced hardware or data redundancy combined with specific software, providing almost instantaneous recovery for single hardware or software failure. The cost of these solutions is much higher than the cluster solution because the cost of redundant hardware must be paid, while the redundant hardware is only idle to wait for the recovery failure. Microsoft Cluster Services offers excellent high availability solutions with a price suitable standard hardware while maximizing the calculation resources. Microsoft Cluster Services Based on a non-shared cluster model. Non-shared models require that although multiple nodes in the cluster can access device or resources, this resource can only be possessed and managed at a time. (In the MSCS cluster, resources refer to any way online or offline, can be managed in the cluster, which can only be provided by one node and can be moved between nodes.) Figure 2: Microsoft Cluster Services Cluster Services Architecture Microsoft Cluster Services contains three main components: cluster services, resource monitors, and resource DLLs. In addition, the cluster manager also allows an extended DLL that provides management functions. The cluster service cluster service is a core component and is running as a high priority system service. Cluster service Control cluster activities and performs the following tasks: Coordinating event notifications, facilitating communication between group components, processing failover operations and management configurations. Each cluster node runs its own cluster service. Resource Monitor Resource Monitor is an interface between cluster services and cluster resources and operates as a stand-alone process. Cluster Services uses resource monitors to communicate with resource DLLs. DLL processes all communications with resources, so host DLLs on the resource monitor protects the cluster service from erroneous operation or stopping the work of resource. A number of copies of the resource monitor can run on a single node, so that the unpredictable resources can be separated from other resources. The cluster service sends a request to the resource monitor assigned to the resource when the resource execution is required. If the DLL of the type of resource can be handled in the process of the resource monitor, the DLL associated with the resource type is loaded using the registration information. Then, the request for the cluster service is then passed to the entry point function of one of the DLLs. The resource DLL will process the details of the operation to meet the specific needs of the resource. Resource DLL The third primary Microsoft cluster service component is a resource DLL. Resource Monitor and Resource DLL communicate with resource APIs. Resource API is a collection of entry points, callback functions, and related structures and macros used to manage resources. For cluster services, resources are any physical or logical components that can be managed, such as disks, network names, IP addresses, databases, sites, applications, and any other entity that can be online and offline. Resources can be organized according to the type. Resource types include physical hardware (such as disk drives) and logical terms (such as IP addresses, file sharing, and general applications). Each resource uses the resource DLL, which is mainly the passive conversion layer between resource monitors and resources. The resource monitor calls the entry point function of the resource DLL to view the status of the resource and enables the resource online and offline. Resource DLL is responsible for communicating with its resources through a convenient IPC mechanism to achieve these methods.
Implementing its own resource DLL and cluster services communications and applications using cluster API requests and update cluster information are defined as cluster-related applications. The cluster is not identified without using the cluster or resource API and the cluster control code function, and whether the cluster service is running. These cluster-independent applications are usually managed as a general application or service. Cluster-related and cluster-independent applications can run on the cluster node and can be managed as a cluster resource. However, only cluster-related applications can utilize the cluster services through the functionality provided by the cluster API. Develop cluster related applications require a custom resource type. By custom resource types, developers can make applications in a cluster in a cluster (for example, the node is about offline, so it will turn off the database connection), making the necessary responses and take action. For most applications that need to be run in the cluster, it is best to spend some time and resource development custom resource types. The application can be tested in the cluster environment without having to modify the application's code or create a new resource type. In Windows .NET Server 2003, an unmodified application can be run as a "cluster-related" application at the base level. Cluster Services provides a general application resource type for this purpose. Cluster Manager Extended DLL Cluster Manager Extended DLL provides an application-specific management capabilities within the cluster manager, allowing users to manage their applications in the same way, whether the application is running inside the cluster or in the cluster. Developers can provide application management functions in the Cluster Manager framework, or just link to an existing management tool. Developers can use the functionality of the extended DLL extended cluster manager. The cluster manager application communicates with the extended DLL through a set of defined COM interfaces. Extending the DLL must implement a specific set of interfaces and register each node in the cluster. Figure 3: Main components: Cluster services, resource monitor, and resource DLL cluster-independent applications do not provide their own resource DLLs or services can still be configured in a cluster environment. Cluster services in Windows .NET Server 2003 include General Resources DLLs only for this purpose: General application resource DLL and general service resource DLL. The cluster service treats these applications or services as a general application or service that is unrelated to the cluster. The general resource DLL only provides the most basic control. For example, a typical application resource DLL checks whether the application has failed by determining whether the application's process is still present, and makes the application offline by terminating the process. But it does not rely on other resources, but provides a simple way to test applications in a cluster environment. High availability notepads do not work effectively in the cluster. The most effective evaluation method is to actually deploy applications in the cluster. The simplest mechanism to perform the initial test is to use the built-in general application resource type to register the application into the cluster. "Generic Application" resource type is provided as part of the cluster service in Windows .NET Server 2003, you can view "Cluster Configuration" in "Cluster Configuration" in "Cluster Configuration" (Cluster Configuration) " Types "(Resource Type) Node View this type and other built-in resource types (see Figure 4). Figure 4: The Resource Type Cluster Manager in the Cluster Manager Tool has an interactive wizard to create a resource for any resource type listed. The cluster service also provides a COM interface that allows programming and managing resources. Note: The latest cluster manager tools and associated development resources can be obtained from Platform SDK.
The Cluster Automation Server Cluster Automation Server provides a set of automated objects to disclose a complete cluster management interface to the scripting language to enable you to develop web-based remote management tools. The cluster automation server can simplify and enhance the process of creating cluster management applications. Object-oriented nature of the cluster automation server means that almost all cluster programming tasks will perform the following steps: Determine the cluster operation you need to do. Find a cluster automation server object with properties or methods to complete the operation. Determine how to get the object in step 2. The object hierarchy provided in MSDN® can be used for this purpose. Get objects and invoke properties or methods. For explanation, we will use Windows Scripting Host and Microsoft VBScript to programmatically create a general application resource. Cluster object cluster objects are top objects that allow new instances to be created. The progID of the cluster object is "MSCluster.cluster": Set Ocluster = CreateObject ("Mscluster.Cluster")
Open Cluster Before using any method on the cluster, you must first open the connection with the cluster. The OPEN method will open the connection to the cluster. Pass the empty string ("") to the OPEN method in parameters will open the connection to the cluster on LocalHost. The script will run on the localhost server: ocluster.open ("")
Creating a group cluster group is a container for cluster resources. When a resource in the group failed and must transfer the resource to another node, all resources in the group will be moved. The group also defined the dependency boundary. If the resource is in the same group, the resource can only establish the dependencies with another resource. In the test, we will create a unique group called "High Availability Notepad": Set OGroup = Ocluster.ResourceGroups.createItem ("High Availability Notepad")
Creating a resource Each group contains a collection of resources. The CreateItem method creates a new resource and adds it to the group collection. In the example, we will create a resource called "notepad", the resource type is "generic application": set ORESource = OGroupResources.createItem ("notepad", "Generic
Application ", 0)
Setting the resource attributes Each general application resource has two basic properties that enables the resource online: CommandLine and CurrentDirectory. Commandline contains the command to be executed when the resource is online, and the CurrentDirectory specifies the file system directory that executes the command. When this script enforces the statement of the resource online, NOTEPAD will be launched. To view NotePad, we must also set the interactWithDesktop property to 1. SET OPROPERTIES = ORESOURCE.PRIVATEPROPERTIES
'Set the properties of the general application
Oproperties.Item ("CommandLine") = "NOTEPAD"
Oproperties.Item ("currentdirectory") = "c: /"
OPROPERTIES.ITEM ("InteractwithDesktop" = 1
Oproperties.savechange
Enable the resource online method to enable the resource online. Online is a state for describing the resource to the cluster. For our general application, the resource online indicates the startup NOTEPAD. ORESOURCE.ONLINE 10 Complete Script List Option Explicit
Main
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''
The main routine.
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' ''
Sub main
DIM OGROUP
DIM OCLUSTER
Dim Oresource
'Creating a Cluster object.
Set Ocluster = CreateObject ("MSCluster.cluster")
'Open the cluster. Empty string represents the local cluster.
Ocluster.Open ("")
'Create or open the group.
AddGroup Ocluster, OGroup
'Create or open resources.
AddResource Ogroup, ORESOURCE
'Let resources online, and wait within 10 seconds
'It actually recovers online status.
ORESOURCE.ONLINE 10
End Sub
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
'This subroutine will create or open the group.
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' 'Sub Addgroup (Ocluster, OGroup)
Set OGroup = OCluster.ResourceGroups.createItem ("High Availability Notepad")
End Sub
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
This subroutine will add resources to the group.
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
Sub AddResource (OGroup, ORESOURCE)
DIM OGroupResources
DIM OPROPERTIES
DIM OCLPROPERTY
DIM OCDPROPERY
Set OgroupResources = OGroup.Resources
Set Oresource = OGroupResources.createItem ("NOTEPAD", "Generic
Application ", 0) 'Cluster_Resource_Default_Monitor
SET OPROPERTIES = ORESOURCE.PRIVATEPROPERTIES
'Set the properties of the general application
Oproperties.Item ("CommandLine") = "NOTEPAD"
Oproperties.Item ("currentdirectory") = "c: /"
OPROPERTIES.ITEM ("InteractwithDesktop" = 1
Oproperties.savechange
End Sub'''''''''''''''''''''''''''''''''''''''''''''''' '' '' '' '' '' '' '' '' '' '
'Waiting for the specified time.
'' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '
Sub Sleep (Pauseetime)
DIM START
Start = Timer
Do While Timer Loop End Sub