Hyper-V Cluster Setup 3 of 3: Cluster Creation, Cluster Shared Volume, Highly Available VM

Now that we have the initial work out of the way in preparing our hosts, storage, networks and other details, we can look at actually creating the Hyper-V cluster, provisioning a cluster shared volume, and creating a highly available VM.

Creating Hyper-V Cluster

Once the Test-Cluster PowerShell commandlet has been ran to validate the cluster configuration before creating the cluster and any items that need to be reviewed have been checked, we are now good to go ahead and create the cluster.

Using PowerShell, creating the cluster is a simple one-liner very similar to the Test-Cluster commandlet. Below we tell the new-cluster commandlet to create a cluster with the name we choose, which nodes to use, as well as assign a static address to the cluster.

  • New-Cluster -Name HVCluster -node H1,H2 -staticAddress 192.168.85.75
reating Hyper-V Cluster

When the cluster creation process is finished.

HV Cluster creation

Clustered Shared Volumes

Even though we have shared storage from an iSCSI target prospective, we need to make sure the storage our VMs will live on is setup on a clustered shared volume. The clustered shared volume or CSV was introduced in Windows Server 2008 R2 and was designed to be used with the Hyper-V role so that a virtual machine can have VHD files accessed by any node in the cluster. There is also resiliency built into CSV including I/O fault detection allowed for alternate communication paths to be used in the event of communication failures that might be detected.

Let’s take a look at creating the clustered shared volume for our VMs. First, let’s rename our cluster disk resource that will be used for VM storage. In my lab setup, this is Cluster Disk 1:

  • (Get-ClusterResource | ?{$_.Name -eq “Cluster Disk 1”}).name = “VMs”

Once the cluster disk is named what we want it to be (not a requirement but makes identification easier), we can add this volume to a cluster shared volume:

  • Get-ClusterResource -Name “VMs”| Add-ClusterSharedVolume

We can also use the Failover Cluster Manager console to add a disk to the CSV as well:

Add Cluster Shared Volume

Afterward, we can check to see the state of the cluster shared volume by the get-clustersharedvolume commandlet:

Cluster Shared Volume State

If you have a management workstation to connect using the Failover Cluster Manager, you can look at your storage with the GUI console by connecting to your Windows Failover Cluster. Here we can easily see the Disks available and what role they are assigned to. Below we see both the Quorum and VMs disk that is designated as a cluster shared volume.

Failover Cluster Manage

Changing Hyper-V Settings

Now that we have our clustered shared volume setup, we can change our Hyper-V settings to use our CSV as the default location for storing our VMs. Looking at the Hyper-V Settings for each host, change the Virtual Hard Disks location and the Virtual Machines location to your cluster shared volume which is C:\ClusterStorage\volume(x) on your Hyper-V hosts.

Change Hyper-V Settings in Hyper-V Manager

Creating a Highly Available VM

We can now begin to create a highly available VM in our Failover Cluster Manager console. Right-click the Roles and choose to create a New Virtual Machine.

Failover Cluster Manager - New Virtual Machine

Choose the host for the virtual machine.

Target Cluster Node for VM

Work through the New Virtual Machine Wizard prompts to provision a new virtual machine.

New Virtual Machine Wizard

Note the virtual machine is created on our clustered shared volume.

Connect Virtual Hard Disk

Finally, we get to the end of the new virtual machine wizard where our options we selected are displayed.

Completing the New Virtual Machine Wizard

When you click finish, the High Availability Wizard displays the summary of enabling high availability on the role and the virtual machine. As you can see we have success.

Hyper-V High Availability Wizard

If you want to take a look at the high availability report, you can click the View Report button which will display a more detailed rendering of the high availability tests.

High Availability Report

We now have a highly available VM running in our Hyper-V cluster!

Hyper-V Failover Cluster

Thoughts

When thinking about high availability in the enterprise datacenter using Microsoft Windows Server 2016 Hyper-V, creating a Hyper-V cluster provides a resilient and highly available solution for hosting virtual machines. As we have seen in this and previous posts, creating a Hyper-V cluster requires properly planning the details of the installation. This includes host configuration, as well as planning and configuration of networks, storage, and virtual machine high availability. Using PowerShell, most of this work can be accomplished on Windows Server 2016 Hyper-V Server Core installations as well as GUI management consoles once connectivity to the hosts are established.

Microsoft Windows Server 2016 Hyper-V is a great platform for enterprise virtualization and provides a highly scalable and available solution for enterprise datacenters.

Share:

LinkedIn Google+