Failover Clustering and Network Load Balancing Team Blog
With Windows Server 2008 (and R2) Failover Clustering you can make almost anything highly-available. This does not only include programs and applications, but you can make any service running on the cluster highly available – even if it is custom or from a 3rd party. These can be created, managed by and integrated with Failover Clustering using a generic container, with services using the Generic Service resource type. Generic Service resource type allows us to manage Windows Services as cluster resources. They are similar to the Generic Application resource types in that they also provide basic functionality. For example, when a service is online it means that the service is running. Additionally Service status (such as online, offline, failed etc) can be determined by querying the Services Control Manager (SCM) (more information).
In this section, we will cover how to create and configure a generic service resource using the following methods:
1. High Availability wizard
2. PowerShell cmdlets
3. Cluster.exe command-line tool (to be deprecated after Windows Server 2008 R2)
We will be using Application Experience service as an example. This service ships in Windows Server 2008 R2.
Before creating a generic service resource, please review the checklist at below link.You need to ensure that the service is installed on all clustered nodes.
I have a 2-node cluster running Windows Server 2008 R2. Cluster name is A1C1F4X64.
Name of my cluster nodes are:
Below is a partial screenshot of Failover Cluster Manager.
Now I will walk you through the High Availability wizard of Failover Cluster Manager to create a generic service resource. Below are the steps:
1. Launch Failover Cluster Manager from Start menu. Connect to the cluster.
2. Right click on Services and applications, and click on Configure a Service or Application…
3. High Availability Wizard appears. After reading the information presented on Before You Begin page, click Next.
4. On Select Service or Application page, select Generic Service and click Next.
5. Select Service page appears. This page lists all the services that are running on the clustered nodes. Select “Application Experience” and click Next.
6. On Client Access Point page, we will be providing input for the network name and IP addresses that clients will be using when accessing our highly available generic service. I am choosing a network name (A1C1F4X64GSvc) and a static IP address suitable for my network configuration.
7. On Select Storage page, you have an option to choose a disk for the generic service. If the generic service needs a disk resource, you can select a disk. In my example, Application Experience service is not going to use any disk. So, we are not making any selection.
8. On Replicate Registry Settings page, add the registry keys that the service will be using/updating. These are the keys that the service requires for it to function properly. Once added, the registry keys will be replicated on all cluster nodes so that the service will be functional on all nodes of the cluster.
In our example, Application Experience service does not require presence of any specific registry key to be functional. However, for the purpose of demonstrating an example, we will add two registry keys.
First click on the Add… button. This should bring the Registry Key dialog where you can input the registry key. After entering the registry key, click OK.
By following this step, we have added two registry keys as shown in the below screen.
9. On Confirmation page, verify that the information is correct. If you need to make modifications, you can use Previous button to go back to the previous pages in the wizard and modify the information.
10. The Wizard should successfully create the generic service resource and bring the resource online. A Summary page appears.
11. On Summary page, you can click on View Report… button. This will show you detailed report of what actions were taken to create the generic service resource.
The report will also be located under %SystemRoot%\Cluster\Reports directory for later viewing.
12. Locate the newly created item (A1C1F4X64GSvc) under Services and applications. This is the container (also known as group) for the generic service resource.
Above image shows that group A1C1F4X64GSvc is online on N2. The name of the generic service resource is “Application Experience”.
I will now show you how to use PowerShell cmdlets to create a generic service resource. PowerShell is new to Failover Clustering in Windows Server 2008 R2 and will replace Cluster.exe in the next release (more information about WSFC PowerShell). The cmdlets that we need to achieve this are: Get-Cluster and Add-ClusterGenericServiceRole.
If we are running PowerShell on a machine that is not part of the cluster, we have to retrieve the cluster object first using the Get-Cluster cmdlet. Once we retrieve the cluster object, the object can then be passed to the Add-ClusterGenericServiceRole cmdlet. This is needed to specify the cluster where the resource will be created.
If we are running PowerShell on a clustered node, Get-Cluster cmdlet may be omitted and Add-ClusterGenericServiceRole can be used directly. In this case cluster object will be retrieved from the local node (i.e. the node where the command is executing).
We also need to identify the service name that we want to cluster. To do this, launch Services.msc (Service Control Manager), and launch the properties window for the service. Service name is highlighted in the below screenshot.
Here is an example command line to create the generic service resource (Note that A1C1F4X64 is our cluster name):
PS C:\Windows\system32> get-cluster A1C1F4X64 | Add-ClusterGenericServiceRole -ServiceName AeLookUpSvc -Name A1C1F4X64GSVC -StaticAddress 172.24.11.96
Report file location: C:\Users\wolfpack\AppData\Local\Temp\tmpF8BA.tmp.mht
Name OwnerNode State
---- --------- -----
A1C1F4X64GSVC a1c1f4x64n2 Online
To get further help, you can issue the below command on a PowerShell window:
The following command will show you example usage:
Get-Help Add-ClusterGenericServiceRole -examples
For extended information, you can use:
Get-Help Add-ClusterGenericServiceRole -full
Cluster.exe is another command line tool that can be used to administer a cluster, however Windows Server 2008 R2 is the final release, so it is recommended to use PowerShell to create new scripts and utilities. Cluster.exe will coexist with PowerShell in Windows Server 2008 R2, however you will be able to see that PowerShell significantly simplifies the process.
Below is a sample script that creates and onlines a generic service resource.
REM Store cluster name in a variable
REM Create a group and online it
cluster %ClusterName% group GenSvcGroup /create
cluster %ClusterName% group GenSvcGroup /on
REM Create a IP address resource, set required properties, and online it
cluster %ClusterName% res GenSvcIP /create /group:GenSvcGroup /type:"IP Address"
cluster %ClusterName% res GenSvcIP /priv address=172.24.11.96 SubnetMask=255.255.255.0
cluster %ClusterName% res GenSvcIP /on
REM Create a network name, set properties, set dependency on the IP resource, and online it
cluster %ClusterName% res GenSvcNN /create /group:GenSvcGroup /type:"Network name"
cluster %ClusterName% res GenSvcNN /priv Name=%ClusterName%-NN
cluster %ClusterName% res GenSvcNN /setdep:"[GenSvcIP]"
cluster %ClusterName% res GenSvcNN /on
REM Create a generic service resource, set the properties, and online it
cluster %ClusterName% res GenSvcRes /create /group:GenSvcGroup /type:"Generic Service"
cluster %ClusterName% res GenSvcRes /prop RestartAction="0"
cluster %ClusterName% res GenSvcRes /priv ServiceName=AeLookUpSvc
cluster %ClusterName% res GenSvcRes /priv StartupParameters="-k netsvcs"
cluster %ClusterName% res GenSvcRes /on
The script does the following:
1. Creates and onlines a group called GenSvcGroup.
2. Creates an IP address resource called GenSvcIP in group GenSvcGroup. Sets Address and SubnetMask properties of the resource. Brings the IP resource online.
3. Creates a network name resource called GenSvcNN. Sets the Name property of the network name resource, sets the dependency of the network name to the IP resource, and brings the network name online.
4. Finally, it creates the generic service resource, sets the properties, and brings the resource online.
· Generic Service resource type - http://technet.microsoft.com/en-us/library/cc784978.aspx
· Checklist: Installing a Generic Service resource - http://technet.microsoft.com/en-us/library/cc758806.aspx
· Cluster-Unaware applications - http://msdn.microsoft.com/en-us/library/aa369166(VS.85).aspx
· Generic Service - http://msdn.microsoft.com/en-us/library/aa369600(VS.85).aspx
· Windows Clustering - http://msdn.microsoft.com/en-us/library/aa373130(VS.85).aspx
· Configuring and Creating a Generic Application resource: http://blogs.msdn.com/clustering/archive/2009/04/10/9542115.aspx
In the upcoming weeks I will be adding a post about creating and configuring Generic Scripts.
Regards,Daud HowladerSoftware Development Engineer in TestClustering & High AvailabilityMicrosoft
PingBack from http://eras.blog-giant.com/2009/06/05/wikipediaproposition-articles-de-qualite/
PingBack from http://www.csharphacker.com/technicalblog/index.php/2009/06/09/interesting-stuff/
PingBack from http://fixmycrediteasily.info/story.php?id=4750
PingBack from http://www.mcseboard.de/windows-forum-ms-backoffice-31/verfuegbarkeitscluster-best-dienst-153158.html#post942372
Thanks a lot, thats useful. Can we do the same thing in Windows Server 2003 ? All I need is for Windows to startup my service on the secondary host when the primary host is down.
Yes, Generic Service resources were available for use in 2003, however the steps to configure it are different since. For more information on 2003, check out: http://technet.microsoft.com/en-us/library/cc758806(WS.10).aspx
Every example (and piece of documentation) I have seen around creating generic resources using cluster.exe / powershell omits anything about setting the registry key replication property - which, naturally, is the part I need. Would you be able to shed any light on this?
[Symon Perriman] Hi, this is documented at: http://technet.microsoft.com/en-us/library/ee460966.aspx.
>Add-ClusterGenericServiceRole [-InputObject <psobject>] -ServiceName <string> [[-Name] <string>] [-CheckpointKey <StringCollection>]
Specifies a comma-separated list of registry checkpoint keys to add for this highly available generic application. All registry paths are relative to HKLM\.
Apologies - meant to say "generic service resources"
Great post! very useful and concise.
Also check this blog post on “Mapping Cluster.exe Commands to Windows PowerShell Cmdlets for Failover Clusters – Extended Edition”. It includes a table with an extensive mapping of CLUSTER.EXE commands (including parameters) to PowerShell cmdlets. It also lists the new PowerShell cmdlets that have no equivalent in the old CLUSTER.EXE.
See the post at blogs.technet.com/.../mapping-cluster-exe-commands-to-windows-powershell-cmdlets-for-failover-clusters-extended-edition.aspx
very nice article.
is there a way with command line or powershell to add a service to an existing Cluster Generic Service?