Creating Failover Clusters in Windows Server 2012 Hyper-V

In this article we will go through how to set up high availability using failover clustering with Hyper-V in Windows 2012 and also in the free Hyper-V 2012 Server.


Windows 2012 Hyper-V allows us to use live migration between virtual machine hosts without having them in a failover cluster. With the new shared nothing live migration we can also live migrate the virtual machine — including the storage — without downtime. In fact, the new Hyper-V cluster can be up to 64 virtual machine hosts and with an amazing 8,000 (!) running virtual machines in total.

One big improvement in the new cluster is that you don’t need to shut down the virtual machine before adding it to the cluster. This means that you can live migrate virtual machines with storage from standalone hosts to a cluster, making them highly available without any outage of the service the virtual machine runs.

The failover cluster can also utilize the new SMB 3.0 file shares for the virtual machines. And if you still want to continue with Cluster Shared Volumes, they have been improved in several ways. There’s also a new file system Clustering for Scale Out File Server (CSVFS) with the new CSV v 2.0. This new version includes resilience features to protect your volumes from corruption. You can now also use the CSVs with a file server cluster, which was not possible in the Windows 2008 R2 version where the CSV was only allowed for the Hyper-V role.

Creating a Failover Cluster with PowerShell

Since I’m a fan of PowerShell, I will show you how to create the cluster from the console. There are some PowerShell cmdlets to handle the cluster (actually there are 81). This first line adds the failover cluster role to the host HV02, without that role we cannot create any cluster.

If I want to create the simplest form of cluster without any configurered storage and I have a DHCP for address allocation, I use this cmdlet:

If you are setting up several nodes and want to manage them from a remote workstation or administration server, you have to add the management tools there instead and then you maybe do not have to use the parameter –IncludeManagementTools on the above command.

After the cluster is created, we can check it out in the failover cluster manager, shown below.


And if we want to add some storage presented via either iSCSI or FC, just click on the storage and disk in the Failover Cluster Manager.

Failover Cluster Add Disk


Here we get a list of storage that is presented to the hosts and we can chose what volumes we want to add to the cluster.

Failover Cluster Add Disk


The next step is to make the disks into cluster shared volumes.

Failover Cluster Shared Cluster volumes


Adding Virtual Machines to the Cluster

It is quite easy to add all the virtual machines running on this node with the PowerShell cmdlets. Of course, this requires that the VMs already reside on some kind of shared storage.

Doing this with PowerShell instead of the GUI will save you some time if you want to add several virtual machines at the same time. In the following images I will show you how to add a virtual machine to the cluster from the Failover Cluster Manager. First, in the GUI you press the configure role and then it is quite straight forward.

In the list we have all the different roles that can be set up in the cluster. Right now we want the virtual machine role.

Failover Cluster high availability wizard

And then we will select for which virtual machine or machines we want to enable high availability.

Failover Cluster high availability wizard

After selecting your VMs, click Next. If all the machines selected already were on shared storage, you will get a success report saying the virtual machines now are highly available.

Failover Cluster high availability wizard


Affinity and Priority of VMs

Now, there are some more configuration settings that can be made. If we, for example, have a VM that we want to be on a specific host we can use the affinity rules. Also, if we have overallocated the cluster we want to set different startup priority so that the most important virtual machines start first.

The different startup priorites that can be set are:

  • High
  • Normal
  • Low
  • No Auto Start

Failover Cluster roles

The affinity rules have two options: preferred owners and possible owners. Of course, they do not appear on the same configuration place! One reason for not allowing a virtual machine on some hosts is license allocation. Another reason may be that you have domain controllers — and having all DC on the same hyper-v host node would not be the best situation if that physical machine stops.

Take a look at the virtual machines properties in the Failover Cluster Manager. It will give you the following properties; as you can see both preferred owner and priority owner can be set here.

Failover Cluster VMtest


To configure the possible owners, we have to find the advanced properties. In the Failover Cluster Manager that can be found by going to Resources, selecting the virtual machine, and then select Properties.

Failover Cluster manager


Here you get a different set of properties compared to the above. These are where you can set up the possible owners of the virtual machines, as seen below.

Failover Cluster vmtest properties


VM Monitoring and PowerShell

There is another feature in the failover cluster called VM Monitoring. With this you can add extra monitoring for the services inside the virtual machine; if they stop, the Failover Cluster Manager can restart the VM. This should be used with a bit of caution because restarting the VM will affect the other services on that machine as the whole OS will restart. A requirement when using VM Monitoring is that the virtual machine must be part of the domain that the cluster resides in and have the monitoring firewall rule enabled. The cluster also must have network connectivity via the virtual network adapter to the virtual machines OS.

Setting the firewall rule on the VM I want to monitor can be done with PowerShell. Here I also add the remote services management to be able to list the services running from a remote powershell console with Get-Service –ComputerName VMtest.

As for the monitoring, there are several different parameters that can be set, but in this case I want the failover cluster monitoring to override the ordinary service recovery.

I hope that this article has given you a insight in the virtual machine failover cluster in Windows 2012 and that you get as excited as I do over the new functionality and features that this gives to Hyper-V 2012 high availability.



Tagged , , ,


Join The Conversation