Microsoft has long
offered a version of Hyper-V Server, but, for whatever reason, Hyper-V Server
has gained a reputation for only being appropriate for use in a lab environment.
Believe it or not, it is possible to deploy the Hyper-V Server in a way that
allows your Hyper-V virtual machines to be made highly available.
In order to build a
fault-tolerant Hyper-V deployment, there are a few things that you'll need.
First, you will need a storage
array that can be used for shared storage (CSV). These storage
requirements are the same as for any other Hyper-V deployment. Next, you need a
copy of Hyper-V Server, which can be found on the Microsoft website.
Third, you require a
basic understanding of how failover
clustering is normally deployed and configured. Having some up-front
knowledge of failover clustering will make it much easier to build a cluster
based on Hyper-V Server.
Finally, to build a
fault-tolerant Hyper-V
deployment, you must have a general knowledge of PowerShell.
If your PowerShell comprehension is a little rusty, I recommend taking
advantage of the Sconfig.cmd
utility. This utility provides a menu-driven interface for
configuring a server. Employing this utility will minimize the amount of
PowerShell that you will have to use.
The first step in
building a failover cluster using the Hyper-V Server is to install Hyper-V
Server on each server that will act as a cluster node. Once it has been
installed, you will need to use the Sconfig.cmd to establish the initial
configuration for each server. This means assigning an IP address to each network
interface card (NIC), giving each node a unique and meaningful computer name,
joining an Active Directory domain, and enabling remote management. All of
these tasks can be easily completed using the Sconfig.cmd utility.
Once you complete the
initial configuration process, you must make a few decisions regarding your
failover cluster. You will need to choose a name and an IP address
for the cluster. You will also need to figure out how you are going to connect
the cluster nodes to the shared storage. The easiest solution is to create two
Server Message Block file shares. One of these shares will be used as shared
storage, while another is used as a File Share
Witness.
For the sake of
demonstration, let's pretend that you wanted to create a cluster with a cluster
name of "Cluster1" and a cluster IP address of 192.168.0.1. Let's
also assume that the NIC that you want to use for cluster communications on
each cluster node is named "Ethernet 2" -- you can get the actual NIC
name by using the Get-NetAdapter cmdlet. Now imagine that your cluster nodes
are named "Hyper-V-1," "Hyper-V-2" and
"Hyper-V-3". Finally, we will need a Universal Naming Convention path
for our File Share Witness. We will also need to assign a name to the Hyper-V
virtual switch. For the sake of this demonstration, I will use
"Switch1" as the virtual switch name -- each node must use the same
virtual switch name -- and I will use "\\storage\witness" as the File
Share Witness path. Given those conventions, the commands used to build a
failover cluster would be:
Install-WindowsFeature
–Name Failover-Clustering –IncludeManagementTools
New-VMSwitch "Switch1" –NetAdapterName "Ethernet 2" –AllowManagementOS:$True
Test-Cluster –Node Hyper-V-1,Hyper-V-2,Hyper-V-3
New-Cluster –Name Cluster1 –Node Hyper-V-1,Hyper-V-2,Hyper-V-3 –StaticAddress 192.168.0.1
Set-ClusterQuorum –Cluster Cluster1 –NodeAndFileShareMajority \\Storage\Witness
New-VMSwitch "Switch1" –NetAdapterName "Ethernet 2" –AllowManagementOS:$True
Test-Cluster –Node Hyper-V-1,Hyper-V-2,Hyper-V-3
New-Cluster –Name Cluster1 –Node Hyper-V-1,Hyper-V-2,Hyper-V-3 –StaticAddress 192.168.0.1
Set-ClusterQuorum –Cluster Cluster1 –NodeAndFileShareMajority \\Storage\Witness
The only thing left to do
at this point is to connect your shared storage to the cluster. The method that
you will use to do so will vary depending on the type of storage that you are
using. You can use the Add-ClusterDisk cmdlet to get the job done, but I advise
installing the Failover Cluster Manager onto another Windows Server, one that
has a graphical user interface, and use that tool to add storage to the
cluster. That way you won't have to worry about the complexities of configuring
shared storage from the command line.
As you can see, it is
possible to achieve high
availability using the Hyper-V Server. That being the case, you may
be wondering why any organization would pay for a Windows Server license for
their Hyper-V nodes. The answer usually comes down to VM licensing. Windows Server
2012 R2 Datacenter Edition for instance allows a properly licensed Hyper-V host to run an unlimited number of
Windows Server 2012 R2 VMs. Without such a license, VM licensing must be
handled separately, which can be costly and complicated.