Some veteran IT Pros hear the term ‘Microsoft Clustering’ and their hearts start racing. That’s because once upon a time Microsoft Cluster Services was very difficult and complicated. In Windows Server 2008 it became much easier, and in Windows Server 2012 it is now available in all editions of the product, including Windows Server Standard. Owing to these two factors you are now seeing all sorts of organizations using Failover Clustering that would previously have shied away from it.
The service that we are seeing clustered most frequently in smaller organizations is Hyper-V virtual machines. That is because virtualization is another feature that is really taking off, and the low cost of virtualizing using Hyper-V makes it very attractive to these organizations.
In this article I am going to take you through the process of creating a failover cluster from two virtualization hosts that are connected to a single SAN (storage area network) device. However in Windows Server 2012 these are far from the limits. You can actually cluster up to sixty-four servers together in a single cluster. Once they are joined to the cluster we call them cluster nodes.
Failover Clustering in Windows Server 2012 allows us to create highly available virtual machines using a method called Active-Passive clustering. That means that your virtual machine is active on one cluster node, and the other nodes are only involved when the active node becomes unresponsive, or if a tool that is used to dynamically balance the workloads (such as System Center 2012 with Performance and Resource Optimization (PRO) Tips) initiates a migration.
In addition to using SAN disks for your shared storage, Windows Server 2012 also allows you to use Storage Pools. I explained Storage Pools and showed you how to create them in my article Storage Pools I also explained how to create a virtual SAN using Windows Server 2012 in my article iSCSI Storage in Windows Server 2012. For the sake of this article, we will use the simple SAN target that we created together in that article.
Step 1: Enabling Failover Clustering
Failover Clustering is a feature on Windows Server 2012. In order to enable it we will use the Add Roles and Featureswizard.
1. From Server Manager click Manage, and then select Add Roles and Features.
2. On the Before you begin page click Next>
3. On the Select installation type page select Role-based or feature-based installation and click Next>
4. On the Select destination server page select the server onto which you will install the role, and click Next>
5. On the Select server roles page click Next>
6. On the Select features page select the checkbox Failover Clustering. A pop-up will appear asking you to confirm that you want to install the MMC console and management tools for Failover Clustering. Click Add Features. ClickNext>
7. On the Confirm installation selections page click Install.
NOTE: You could also add the Failover Clustering feature to your server using PowerShell. The script would be:
Install-WindowsFeature -Name Failover-Clustering –IncludeManagementTools
If you want to install it to a remote server, you would use:
Install-WindowsFeature -Name Failover-Clustering –IncludeManagementTools –ComputerName <servername>
That is all that we have to do to enable Failover Clustering in our hosts. Remember though, it does have to be done on each server that will be a member of our cluster.
Step 2: Creating a Failover Cluster
Now that Failover Clustering has been enabled on the servers that we want to join to the cluster, we have to actually create the cluster. This step is easier than it ever was, although you should take care to follow the recommended guidelines. Always run the Validation Tests (all of them!), and allow Failover Cluster Manager to determine the best cluster configuration (Node Majority, Node and Disk Majority, etc…)
NOTE: The following steps have to be performed only once – not on each cluster node.
1. From Server Manager click Tools and select Failover Cluster Manager from the drop-down list.
2. In the details pane under Management click Create Cluster…
3. On the Before you begin page click Next>
4. On the Select Servers page enter the name of each server that you will add to the cluster and click Add. When all of your servers are listed click Next>
5. On the Validation Warning page ensure the Yes. When I click Next, run configuration validation tests, and then return to the process of creating the cluster radio is selected, then click Next>
6. On the Before You Begin page click Next>
7. On the Testing Options page ensure the Run all tests (recommended) radio is selected and then click Next>
8. On the Confirmation page click Next> to begin the validation process.
9. Once the validation process is complete you are prompted to name your cluster and assign an IP address. Do so now, making sure that your IP address is in the same subnet as your nodes.
NOTE: If you are not prompted to provide an IP address it is likely that your nodes have their IP Addresses assigned by DHCP.
10. On the Confirmation page make sure the checkbox Add all eligible storage is selected and click Next>. The cluster will now be created.
11. Click on Finish. In a few seconds your new cluster will appear in the Navigation Pane.
Step 3: Configuring your Failover Cluster
Now that your failover cluster has been created there are a couple of things we are going to verify. The first is in the main cluster screen. Near the top it should say the type of cluster you have.
If you created your cluster with an even number of nodes (and at least two shared drives) then the type should be anode and disk majority. In a Microsoft cluster health is determined when a majority (50% +1) of votes are counted. Every node has a vote. This means that if you have an even number of nodes (say 10) and half of them (5) go offline then your cluster goes down. If you have ten nodes you would have long since taken action, but imagine you have two nodes and one of them goes down… that means your entire cluster would go down. So Failover Clustering uses node and disk majority – it takes the smallest drive shared by all nodes (I usually create a 1GB LUN) and configures it as the Quorum drive – it gives it a vote… so if one of the nodes in your two node cluster goes down, you still have a majority of votes, and your cluster stays on-line.
The next thing that you want to check is your nodes. Expand the Nodes tree in the navigation pane and make sure that all of your nodes are up.
Once this is done you should check your storage. Expand the Storage tree in the navigation pane, and then expandDisks. If you followed my articles you should have two disks – one large one (mine is 140GB) and a small one (mine is 1GB). The smaller disk should be marked as assigned to Disk Witness in Quorum, and the larger disk will be assigned toAvailable Storage.
Cluster Shared Volumes was introduced in Windows Server 2008R2. It creates a contiguous namespace for your SAN LUNs on all of the nodes in your cluster. In other words, rather than having to ensure that all of your LUNs have the same drive letter on each node, CSVs create a link – a portal if you will – on your C: under the directoryC:\ClusterStorage. Each LUN would have its own subdirectory – C:\ClusterStorage\Volume1,C:\ClusterStorage\Volume2, and so on. However using CSVs means that you are no longer limited to a single VM per LUN, so you will likely need fewer.
CSVs are enabled by default, and all you have to do is right-click on any drive assigned to Available Storage, and clickAdd to Cluster Shared Volumes. It will only take a second to work.
NOTE: While CSVs create directories on your C drive that is completely navigable, it is never a good idea to use it for anything other than Hyper-V. No other use is supported.
Step 4: Creating a Highly Available Virtual Machine (HAVM)
Virtual machines are no different to Failover Cluster Manager than any other clustered role. As such, that is where we create them!
1. In the navigation pane of Failover Cluster Manager expand your cluster and click Roles.
2. In the Actions Pane click Virtual Machines… and click New Virtual Machine.
3. In the New Virtual Machine screen select the node on which you want to create the new VM and click OK.
The New Virtual Machine Wizard runs just like it would in Hyper-V Manager. The only thing you would do differently here is change the file locations for your VM and VHDX files. In the appropriate places ensure they are stored under C:\ClusterStorage\Volume1.
At this point your highly available virtual machine has been created, and can be failed over without delay!
Step 5: Making an existing virtual machine highly available
In all likelihood you are not starting from the ground up, and you probably have pre-existing virtual machines that you would like to add to the cluster. No problem… However before you go, you need to put the VM’s storage onto shared storage. Because Windows Server 2012 includes Live Storage Migration it is very easy to do:
1. In Hyper-V Manager right-click the virtual machine that you would like to make highly available and click Move…
2. In the Choose Move Type screen select the radio Move the virtual machine’s storage and click Next>
3. In the Choose Options for Moving Storage screen select the radio marked Move all of the virtual machine’s data to a single location and click Next>
4. In the Choose a new location for virtual machine type C:\ClusterStorage\Volume1 into the field. Alternately you could click Browse… and navigate to the shared file location. Then click Next>
5. On the Completing Move Wizard page verify your selections and click Finish.
Remember that moving a running VM’s storage can take a long time. The VHD or VHDX file could theoretically behuge… depending on the size you selected. Be patient, it will just take a few minutes. Once it is done you can continue with the following steps.
6. In Failover Cluster Manager navigate to the Roles tab.
7. In the Actions Pane click Configure Role…
8. In the Select Role screen select Virtual Machine from the list and click Next>. This step can take a few minutes… be patient!
9. In the Select Virtual Machine screen select the virtual machine that you want to make highly available and clickNext>
NOTE: A great improvement in Windows Server 2012 is the ability to make a VM highly available regardless of its state. In previous versions you needed to shut down the VM to do this… no more!
10. On the Confirmation screen click Next>
…That’s it! Your VM is now highly available. You can navigate to Nodes and see which server it is running on. You can also right-click on it, click Move, select Live Migration, and click Select Node. Select the node you want to move it to, and you will see it move before your very eyes… without any downtime.
What? There’s a Video??
Yes, We wanted you to read through all of this, but we also wrote it as a reference guide that you can refer to when you try to build it yourself. However to make your life slightly easier, we also created a video for you and posted it online. Check it out!
Creating and configuring Failover Clustering for Hyper-V in Windows Server 2012
For Extra Credit!
Now that you have added your virtualization hosts as nodes in a cluster, you will probably be creating more of your VMs on Cluster Shared Volumes than not. In the Hyper-V Settings you can change the default file locations for both your VMs and your VHDX files to C:\ClusterStorage\Volume1. This will prevent your having to enter them each time.
As well, the best way to create your VMs will be in the Failover Cluster Manager and not in Hyper-V Manager. FCM creates your VMs as HAVMs automatically, without your having to perform those extra steps.
Over the last few weeks we have demonstrated how to Create a Storage Pool, perform a Shared Nothing Live Migration, Create an iSCSI Software Target in Windows Server 2012, and finally how to create and configure Failover Clusters in Windows Server 2012. Now that you have all of this knowledge at your fingertips (Or at least the links to remind you of it!) you should be prepared to build your virtualization environment like a pro. Before you forget what we taught you, go ahead and do it. Try it out, make mistakes, and figure out what went wrong so that you can fix it. In due time you will be an expert in all of these topics, and will wonder how you ever lived without them. Good luck, and let us know how it goes for you!