Showing posts with label windows cluster service. Show all posts
Showing posts with label windows cluster service. Show all posts

Tuesday, 6 December 2011

Manual Failover of Cluster Groups

As part of my series in Active-Active clustering, first post here, I was trying to failover the cluster disks to take a screenshot and it turns out that it isn’t possible to failover a group from one node to the next using Cluadmin.msc

So after a quick google search I found this:
cluster group "cluster group" /move:<nodehostname>

Active-Active MS SQL Server Failover Cluster using ESX 4.0 - part 2

In the second part of this series, I will show how to install and configure a failover cluster in Windows 2008.  Following from the previous post, I’m going to assume that you have already installed Windows 2008 to both nodes.

In order to make your life easier it would be a good idea to name the network cards in Windows, public and private. I’ve given 192.168.168.1 & 192.168.168.3 respectively to the private network NICs, whereas the public network NICs have been given an IP address in our development network (10.168.20.240 & 10.168.20.241).

An active-active cluster needs three A Name Records in your DNS server:
  • One Record for the Windows cluster (win2k8cluster -> 10.168.20.242).
  • Two Records for each “SQL cluster” sql2k8a & sql2k8b -> 10.168.20.243 & 10.168.20.244 respectively.

You can add the LUNs (SAN Volumes) to Windows. Run the Computer Management console, from Start -> Run  -> compmgmt.msc, and select Disk Management:
  1. Right click on disk 1 and select Online. Ensure all disks are selected and click OK.
  2. Right click on disk 1 and click Initialize Disk. 
  3. Right click on disk 1 and select New Simple Volume. Follow the Wizard. Suggest that you provide a Volume Label (e.g. Data A).
Repeat steps 2 & 3 for the other disks.
Figure 2.1 Computer Management Console showing Quorum Disk and two Data disks
In contrast to Windows 2003, where failover clustering is installed by default, in Windows 2008 you need to add the failover clustering feature, which you can do in Server Manager. Thus, from Server Manager:
  1. Click Features.
  2. Click Add Features.
  3. Select Failover Clustering.
  4. Click Install.
You can now start the cluster administration console or Failover Cluster Manager, from Start -> Run -> cluadmin.msc. Note that cluadmin does not appear to work as it did in Windows 2003, you will need to type cluadmin.msc.
Figure 2.2 Failover Cluster Manager Console
You can now create a new cluster, by clicking on create a new cluster. This will launch a wizard that will guide you through the process of creating a new cluster.

On Step 3, run through the validation tests. As I mentioned in the first post of this series, the firewall test failed. This is the error message:

Validate Windows Firewall Configuration
Validate that the Windows Firewall is properly configured to allow failover cluster network communication.
Validating that Windows Firewall is properly configured to allow failover cluster network communication.
An error occurred while executing the test.
There was an error verifying the firewall configuration.
An item with the same key has already been added.


This is an issue with Guest (VM) cloning. I got around it by adding a couple more NICs to the second node, so that it now has 4 NICs, with the first two disabled, not very elegant but it does the trick.
Make sure that you change the ip addresses on NICs 1 & 2 just in case they accidentally get enabled as it could be a barrel of laughs if they inadvertently do get enabled.

On Step 4, enter your cluster name and make sure that you only enable the public NIC for administering the cluster. You need to ensure that the IP address assigned to the public network (10.0.0.0/8) is the IP address of the cluster name.
Figure 2.3 Create Cluster Wizard. Add an Access point for administering the cluster
Follow the wizard until the Cluster is created.

It is advisable to test the reliability of the cluster at this stage. I would suggest that you run the following tests:
  1. Turn off Active node. The cluster resources should failover to the passive node.
  2. Failover Cluster Group. This should move the cluster group to the passive node. This can be accomplished with the following command (needs to be run as an Administrator): Cluster group “Cluster Group” /move:wink2kb
  3. From ESX, switch off the public network on the active node. The cluster should fail over to the passive node. When I tried this, it did not work. I’ll need to investigate.
This concludes part two of the series, in the third part I will show how to install the first SQL Server failover cluster.

Sunday, 6 November 2011

HA windows service with Windows Cluster Service

We support a MS Dynamics CRM application that uses a few SSIS jobs for tidying up data, however they were awfully slow, so we decided to forgo them. In fairness, it is only SSIS jobs that call a web service that were too slow and I'm sure that given enough time, we could make them run faster, but we decided to go for a different route and that was to use a windows service running on the backend, but our backend is clustered, which raises the problem of how to make sure that this service runs in High Availability mode.
It turns out that it is surprisingly easy to do with windows cluster service. There is a resource type called generic service and this can be used to start the service on various nodes as needed.

Assuming that you have your windows service installed in all the nodes in your cluster, this is what you need to do to have a clustered windows service.
  1. Start the cluster console (start|run|cluadmin)
  2. Connect to cluster if needed (it normally connects to the cluster running on the box by default)
  3. Right Click on Groups. Select New| Group. Follow wizard, make sure that all Nodes are available, as shown in the screenshot below and click Finish.
  4. Right Click on the group you have just created. Select New|Resource.
  5. Make sure that you select Generic Service in Resource Type and follow the wizard.  
  6. When prompted for a service name, make sure that this is the service name and not the service's display name. If your service has starts parameters this is where you can add them.  
  7. You can now bring the service online, by bringing the whole group or just the service.
That is all, you should now have an HA windows service. Note that you don't actually have to create a new group, but I think it's just good practice to do so.
Also note that all the windows cluster service will do is to bring the service up after a failover, if your windows service runs a long running process and it stops halfway because the active node goes down, the service will be brought up on the other node, which may or may not cause issues.