Introduction to Microsoft cluster service (MSC)

Source: Internet
Author: User
Tags addgroup

Introduction
In any case, it is not enough to deliver a high-quality application with a rich set of features. In more and more cases, it must meet high availability standards. Is it because the cluster technology seems too advanced, hard to understand and use, and you have not made the application a new level? With Microsoft's cluster service in Windows NT? 4 introduced and officially provided in the Windows Server 2003 series. developers can use some simple tools to deploy applications in the cluster environment. These tools can register applications in the cluster as general applications and control application configurations by writing Windows scripts.
The cluster connects two or more servers to present them to a single computer on the client. Connecting to the server in a group can share the workload and achieve single-point operations/management, and provide a way to meet the increasing needs for corresponding adjustments. Therefore, clusters can generate highly available applications.
This article focuses on one of the three Microsoft server technologies that support clusters: cluster service. We will explain how to easily perform performance checks on applications in a cluster environment without changing the application code.
Three cluster technologies
Microsoft Server provides three clustering technologies: network load balancing (NLB), Component Load Balancing (CLB), and Microsoft cluster service (MSC ).
Network Load Balancing
Network load balancing acts as a front-end cluster to distribute incoming IP traffic in the entire server group. It is an ideal choice for e-commerce Web sites to achieve incremental scalability and outstanding availability. You can connect up to 32 computers running Windows Server 2003 series to share a virtual IP address. NLB enhances scalability by allocating client requests among multiple servers in the cluster. As traffic increases, you can add more servers to the cluster. Each cluster can accommodate up to 32 servers. While providing continuous services to users, NLB also provides high availability, that is, it automatically detects server faults and re-allocates client traffic to other servers within 10 seconds.
Component Load Balancing
Server Load balancer allows you to allocate loads between servers running the business logic of multiple sites. It dynamically balances COM + components in a server group containing up to eight equivalent servers. In CLB, the COM + component is located on a server in a separate COM + cluster. The call to activate the COM + component balances the load on different servers in the COM + cluster. CLB works with NLB and cluster services by acting on the intermediate layer of the multi-layer cluster network. CLB is provided as a feature of Application Center 2000 and can run on the same group of computers as Microsoft cluster services.
Cluster Service
The cluster Service acts as a backend cluster and provides high availability for applications such as databases, message passing, and file and print services. When a server in any node cluster fails or is offline, the MSC attempts to minimize the impact of the fault on the system.

 
Figure 1. Three Microsoft server technologies supporting clusters
Failover through Microsoft cluster service
The MnS failover function is implemented through redundancy among multiple computers connected in a group. Each computer has an independent fault state. To achieve redundancy, you need to install applications on multiple servers in the cluster. However, at any time, the application is online only on one node. When the application fails or the server is down, the application restarts on another node. Windows Server 2003 data center supports a maximum of eight nodes in a group.
Each node has its own memory, system disk, operating system, and a subset of cluster resources. If a node fails, the other node takes over the resources of the faulty node. This process is called "failover "). Microsoft cluster service then registers the network address of the resource on the new node to route the client traffic to the available system that currently owns the resource. When faulty resources are restored to the online status, you can configure the process of allocating resources and requesting client requests as appropriate. This process is called "fault recovery "). To restore an application to the point where a Failover occurs, the node must be able to access the shared storage area that maintains the application state.
Note that the Microsoft cluster service is designed to provide high availability rather than true fault tolerance. The word "Fault Tolerance" is generally used to describe technologies that provide higher-level recovery capabilities. Fault Tolerant servers typically use advanced hardware or data redundancy combined with specific software to provide near-instantaneous recovery from single hardware or software faults. The cost of such solutions is much higher than that of cluster solutions because you must purchase redundant hardware, which is only idle for fault recovery. The Microsoft cluster service uses affordable standard hardware to provide outstanding high availability solutions while maximizing the use of computing resources.
Microsoft cluster service is based on a non-shared cluster model. No shared model stipulates that although multiple nodes in the cluster can access devices or resources, the resources can only be occupied and managed by one system at a time. In the MSC cluster, A resource is a physical or logical component that can be online or offline, managed in a group, and can only be hosted by one node at a time and moved between nodes .)
 
Figure 2. Microsoft cluster service
Cluster service structure
The Microsoft cluster service consists of three main components: cluster service, Resource Monitor, and resource DLL. You can also use the Cluster Manager to create an extended DLL that provides management functions.
Cluster Service
The cluster service is a core component and runs as a high-priority system service. The cluster service controls cluster activities and executes the following tasks: Coordinating Event Notifications, accelerating communication between cluster components, handling failover operations, and managing configurations. Each cluster node runs its own cluster service.
Resource Monitor
Resource Monitor is an interface between cluster services and cluster resources and runs as an independent process. The cluster Service uses the resource monitor to communicate with the resource DLL. DLL processes all communications with resources, so the DLL uses the resource monitor as the host to protect the cluster service from the impact of abnormal or stopped resources. Multiple copies of the Resource Monitor can run on a single node, thus isolating unpredictable resources from other resources.
When you need to perform operations on a resource, the cluster service sends a request to the resource monitor that is allocated to the resource. If the Resource Monitor process does not have a DLL that can process this type of resource, use the registration information to load the DLL associated with this resource type. Then, pass the cluster service request to the entry point function of one of the DLL. Resource DLL processes operation details to meet specific resource needs.
Resource DLL
The third key Microsoft cluster service component is resource DLL. Resource Monitor and resource DLL use resource API for communication. Resource API is a collection of entry points, callback functions, 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, Web sites, applications, and any other entities that can be online or offline. Resources can be organized by type. Resource types include physical hardware such as disk drives) and logical items such as IP addresses, file sharing, and general applications ).
Every resource uses resource DLL, which is a passive conversion layer between resource monitor and resource. The Resource Monitor calls the resource DLL entry point function to view the resource status and bring the resource online and offline. Resource DLL is responsible for communicating with resources through any convenient IPC Mechanism to implement these methods.
Applications that implement the communication between their own resource DLL and the cluster service, and applications that use the cluster API to request and update cluster information are defined as application programs that recognize clusters. Applications and services that do not use clusters, resource APIs, and cluster control code functions do not recognize clusters, nor do they know that cluster services are running. Applications that do not recognize clusters are generally managed as common applications or services.
Both the application that identifies the cluster and the application that does not recognize the cluster can run on the cluster node, and can be managed as cluster resources. However, only the application that identifies the cluster can use the functions provided by the cluster service through the cluster API. To develop an application that identifies a cluster, you must create a custom resource type. By customizing the resource type, developers can enable their applications to have various events in the cluster. For example, if the node is about to be offline, the database connection will be closed, respond and take necessary measures.
For most applications that need to be run in a group, it is best to invest some time and resources to develop custom resource types. However, you can test the application in the cluster environment without modifying the application code or creating a new resource type. In the Windows Server 2003 series, unmodified applications can run as "Unrecognized cluster" applications at the basic level. The cluster service provides general application resource types for this purpose.
Cluster Manager extension DLL
The Cluster Manager extension DLL provides application-specific management functions in the Cluster Manager, allowing users to manage their applications in the same way, whether the application is running inside the cluster or outside the cluster. Developers can provide application management functions within the framework of Cluster Manager, or simply link these functions to existing management tools.
Developers can compile extended DLL to extend the functions of the Cluster Manager. The Cluster Manager application communicates with the extended DLL through a set of defined COM interfaces. The extension DLL must implement a specific set of interfaces and be registered on each node of the cluster.
 
Figure 3. Key components: cluster service, Resource Monitor, and resource DLL
Application that does not recognize the Cluster
Applications or services that do not provide their own resource DLL can still be configured in the cluster environment. The cluster services in the Windows Server 2003 series include general resource DLL for this purpose only: general application resource DLL and general service resource DLL. The cluster Service regards these applications or services as general applications or services that do not recognize clusters.
Generally, resource DLL only provides the most basic control. For example, the application resource DLL checks whether the application fails by determining whether the application's process still exists, and takes the application offline by terminating the process. However, it does not depend on other resources, but provides a simple way to test applications in a cluster environment.
High Availability notepad
Not all applications work efficiently in a group. The most effective evaluation method is to deploy applications in the cluster. The simplest mechanism for executing the initial test is to register the application to the cluster using the built-in general application resource type. "Generic Application" is a general Application) the resource type is provided as part of the Cluster service in the Windows Server 2003 series. You can view the "Cluster Administrator" Cluster Manager) "Resource Types" Resource type under "Cluster Configuration" Cluster Configuration "in the tool) for the node to view this type and other built-in Resource Types, see Figure 4 ).
 
Figure 4. Resource Type nodes in the Cluster Manager Tool
The Cluster Manager has an interactive wizard that allows you to create resources for any resource types listed. The cluster Service also provides a COM interface that allows you to create and manage resources programmatically.
Note that the latest Cluster Manager tools and related development resources can be obtained from the Platform SDK.
Cluster Automation server
The cluster Automation server provides a set of automation objects to publish a complete cluster management interface to the scripting language, enabling you to develop Web-based remote management tools. Cluster Automation Servers simplify and enhance the process of creating cluster management applications.
The nature of the cluster Automation server is object-oriented, which means that almost all cluster programming tasks involve the following steps:
Determine the cluster operation to be performed.
Search for cluster Automation server objects with properties or methods to complete the operation.
Determine how to obtain objects in step 2. MSDN? The object hierarchy provided in.
Obtain the object and call properties or methods.
For instructions, we will use Windows Scripting Host and Microsoft VBScript to program the creation of general application resources.
Cluster Object
The Cluster Object is a top-level object that allows you to create a new instance. The CLUSTER Object's ProgID is "MSCLUSTER. CLUSTER ":
Set oCluster = CreateObject ("MSCluster. Cluster ")
Open a cluster
Before using any methods on the cluster, you must first connect to the cluster. The Open method can Open the connection to the cluster. Pass the Null String ("") as a parameter to the Open method to Open the connection to the cluster on localhost. The script will run on the local host server:
OCluster. Open ("")
Create Group
A cluster group is a container of cluster resources. When a resource in the group fails and must be transferred to another node, all resources in the group will be moved. The Group also defines dependency boundaries. A resource can only establish dependencies with another resource, provided that the resource is in the same group. To perform the test, we will create a unique group named "High Availability Notepad ):
Set oGroup = oCluster. ResourceGroups. CreateItem ("High Availability
Notepad ")
Create Resources
Each group contains a resource set. The CreateItem method creates a new resource and adds it to the set of the group. In this example, we will create a resource named "Notepad" with the resource type "Generic Application ":
Set oResource = oGroupResources. CreateItem ("Notepad", "Generic
Application ", 0)
Set resource attributes
Each general application resource has two basic attributes that can bring resources online: CommandLine and CurrentDirectory. CommandLine contains the command to be executed when the resource is online, while CurrentDirectory specifies the file system directory from which the command is executed. When the script executes a statement to bring the resource online, Notepad is started. To view Notepad, we also need to set the InteractWithDesktop attribute to 1.
Set oProperties = oResource. PrivateProperties
'Set the properties of the Generic Application
OProperties. Item ("CommandLine") = "notepad"
OProperties. Item ("CurrentDirectory") = "c :\"
OProperties. Item ("InteractWithDesktop") = 1
OProperties. SaveChanges
Bring resources online
Online method to bring resources Online. Online is a state that describes the availability of resources to clusters. For general applications, bringing resources online means starting Notepad.
OResource. Online 10
Complete script list
Option Explicit
Main
'''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''
Main subroutine.
'''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''
Sub Main
Dim oGroup
Dim oCluster
Dim oResource
'Create the Cluster object.
Set oCluster = CreateObject ("MSCluster. Cluster ")
'Open the cluster. Empty string means Open the local cluster.
OCluster. Open ("")
'Create or open the group.
AddGroup oCluster, oGroup
'Create or open the resource.
AddResource oGroup, oResource
'Bring the resource online and wait for up to 10 seconds
'For it to come online.
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 the resource 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 Generic Application
OProperties. Item ("CommandLine") = "notepad"
OProperties. Item ("CurrentDirectory") = "c :\"
OProperties. Item ("InteractWithDesktop") = 1
OProperties. SaveChanges
End Sub
'''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
'Wait for a specified number of time.
'''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
Sub Sleep (PauseTime)
Dim Start
Start = Timer
Do While Timer <Start + PauseTime
Loop
End Sub
By running this simple script, you can create a new "Notepad" resource and put it into your group "High Availability Notepad.
Verification Result
We can use the Cluster Manager to verify the results. By viewing the Notepad resource attributes in "Cluster Manager", you can see that the parameters have been correctly set, as shown in Figure 5 ).
 
Figure 5. Notepad resource parameters
View "Advanced") tab, you will see the default properties, indicating that the application can be restarted up to three times in the event of a fault. By default, the LooksAlive and IsAlive polling intervals are values in the resource type, but other values can be rewritten by specifying other values. Because this application has no special code to make it an application that identifies a cluster, it is determined whether it is active only by the presence of processes running in the system.

Figure 6. Notepad resource "Advanced" tab
Test the application
After the Notepad resources are online, they will be started on the server. If the Notepad process is terminated, it will immediately start again. This is because the cluster service plays a role in trying to keep the application open and running. As a general application resource, the cluster service can immediately notice and take corrective actions based on policies whenever the application process is no longer running.
If an application failure does not cause process termination, such as network failure, suspension, or background thread termination, what will happen? Unfortunately, for general application resource types, you can only perform general fault detection. Most developers who write applications that run in a cluster environment tend to generate Custom Resource DLL to handle problems related to applications. If it is not a shortcut for evaluating applications in a group, the application resource type will not be applied.
Conclusion
Microsoft cluster service provides high availability with standard, cost-effective hardware while maximizing the use of computing resources. The cluster service in the Windows Server 2003 series provides powerful tools to make your applications highly available. For some developers, writing an application that identifies a cluster may be costly and difficult. To enable developers to use clusters with low investment, the cluster service provides a general application resource type that allows simple configuration of applications within the cluster. Although the general application resource type may not provide the complexity required by the production application, it provides a test method to view the application execution in the cluster.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.