Microsoft Hyper-V virtualization supports implementing clustering between two or more virtual machines. Clustering between virtual machines is sometimes referred to as “guest clustering.” A Hyper-V guest cluster consists of two or more virtual machines running on the same Hyper-V host. The guest clustering provides availability for applications running inside the virtual machines. A new feature introduced in Windows Server 2012 R2 helps organizations avoid expensive SAN devices to implement a guest cluster. Windows Server 2012 R2 Hyper-V provides shared VHDX, a new feature that can act as a shared storage for a guest cluster. We will explain the requirements for implementing the guest clustering for Hyper-V virtual machines and then go on to show you how to actually implement a Hyper-V guest cluster.
Before you can start implementing guest cluster, there are a few requirements that you need to meet as listed below:
- You will be required two or more VHDX files created on a Windows Server 2012 R2 in a clustered shared volume.
- The VHDX file must reside on a partition that supports SMB 3.02 protocol specifications. You may also host shared VHDX files on a vendor storage device that supports SMB 3.02 protocol specifications. It is necessary to check the with the vendor to ensure it supports all functions implemented in SMB 3.02 protocol by Microsoft developer.
- Two virtual machines running on the same Hyper-V host. You can have guest clustering configured between virtual machines running on remote Hyper-V hosts.
- The Hyper-V host must be running Windows Server 2012 R2 or later operating system.
How to implement Hyper-V guest cluster
You can implement a Hyper-V guest cluster using Hyper-V Manager, System Center Virtual Machine Manager, or by using PowerShell cmdlets. We will provide a brief overview of each method.
Using Hyper-V manager
From the Hyper-V Manager, you will be required to enable the “Virtual Hard Disk Sharing” option for each virtual machine that is going to participate in the guest cluster. You will enable “Virtual Hard Disk Sharing” option for each VHDX file that has been attached to each VM and will act as shared storage for the guest cluster. As you can see in the screenshot below, we enabled the “Virtual Hard Disk Sharing” option for a VHDX file that is attached to a virtual machine:
Using System Center Virtual Machine Manager
When it comes to implementing guest clustering via System Center Virtual Machine Manager, you will be required to use a service template. A Service template in SCVMM is used to deploy two or more virtual machines together, which also provides an option to share the VHDX file across the virtual machines for guest clustering purposes. This is also shown in the screenshot below, which is from a service template configuration.
Using PowerShell cmdlets
It is easy as pie to enable “Virtual Hard Disk Sharing” option using PowerShell. The PowerShell commands below show how to create a new VHDX file, attach to two virtual machines that will participate in the guest cluster, and then enable the “Virtual Hard Disk Sharing” option for each virtual machine.
New-VHD -Path C:\ClusterStorage\Volume1\SharedVHDXFile.VHDX -Fixed -SizeBytes 20GB
Add-VMHardDiskDrive -VMName SQLVM1 -Path C:\ClusterStorage\Volume1\SharedVHDXFile.VHDX –ShareVirtualDisk
Add-VMHardDiskDrive -VMName SQLVM2 -Path C:\ClusterStorage\Volume1\SharedVHDXFile.VHDX -ShareVirtualDisk
Once you have enabled “Virtual Hard Disk Sharing” option for each virtual machine, all you need to do is install the Windows failover cluster feature in each virtual machine and then configure the VHDX file as a shared storage.
As we explained in this article, starting with Windows Server 2012 R2 implementing guest clustering is quite easy. All you need is a bunch of VHDX files and tick the simple option “Enable Virtual Hard Disk Sharing” to allow Windows failover cluster service to detect VHDX file as a shared storage.