Skip to main content

Implementing Failover Clustering for Hyper-V

Virtualizing your servers is a good way to reduce your expenses through hardware reduction.  You simply take several underutilized servers and move their activities to a single server.  This does create the obvious issue of single point of failure.

This set of instructions will help you set up a test lab for Hyper-V failover.  In a production failover environment, you would utilize at least 2 servers for the fail over cluster.  It is best to use two identical servers for this purpose. Also, you need to check to make sure all the hardware in the servers is supported by Windows Server 2008 R2.  It increases the chances of a successful failover.  You should also have 2 NICs in these servers.  One for the public network, and one for the storage network.  The final element will be a highly available storage system.  This storage system will hold the virtual machine.  A simple diagram of this setup looks like this:
image

In this test, we will use a third server acting as or storage device. Since the iSCSI Target Software requires either Windows Storage Server or the specific iSCSI Target software from your vendor, I am adding a virtual machine to our storage server.  This VM will serve as our iSCSI target.
image

Our Hyper-V machines will be called Lab1 and Lab2.  Our storage system will be hosted on a Windows 2008 R2 Hyper-V server.  The VM will be called SAN-VM.

Step 1: Set up virtual network.
In step 1, we will configure a virtual network that will allow our virtual machines to to communicate outside of their host server.

On both Lab1 and Lab2, open Hyper-V Manage.

In the Actions pane, click Virtual Network Manager

Select External and then click Add.

Provide a descriptive name for this network connection.  I am calling this one SAN.

Enter a description if you wish.

From the dropdown list, choose the network adapter that is connected to your SAN.

Click OK.

On the Apply Networking Changes window, click Yes.


Step 2: Install iSCSI target on the storage server.
Remember, you need Windows Server 2008 storage server or the iSCSI target software from your OEM to continue with this procedure.

On SAN-VM, click Start \ Administrative Tools \ Microsoft iSCSI Target Software.

Click YES or log in if the UAC prompt appears.

Right click iSCSI Targets and then click Create iSCSI Target.

On the Welcome to the Create iSCSI Target Wizard page, click Next

In the iSCSI target name field, type LUN-01 (You can use any name you want here.)  Click Next.

On the iSCSI Initiators Identifiers page, click the Advanced button.

In the Advanced Identifiers dialog box, click Add.

Change the Identifier type to IP Address.

Set the IP address of one of the two servers you will be using in the cluster. 

Repeat this above process to add the second servers IP address.  For my setup, I entered 192.168.1.50 and 192.168.1.114.

image

Click OK.

On the iSCSI Initiators Indentifiers page, the IGN Identifier field show display “Click Advanced button to view alternate identifiers”  Click Next

Click Finish


Step 3: Create and set up an iSCSI target for the witness disk of the Failover Cluster.

In the iSCSI Target – [Microsoft iSCSI Software Target] window, right click Devices and select Create a virtual disk.

Click Next

In the File field, type the full path of the virtual hard disk you want to create.  I entered C:\Disk01.vhd and click Next.

In the Size field, I entered 8000.  Enter what is appropriate for your witness disk.

Click Next.

Enter a description if necessary and click Next.

On the Access page, click Add.

Select the iSCSI target you created earlier.  In this case LUN-01 and click OK.

Click Next.

Click Finish.


Step 4: Create and setup a iSCSI target for the Virtual Machine that you will make highly available.

In the iSCSI Target – [Microsoft iSCSI Software Target] window, right click Devices and select Create a virtual disk.

Click Next

In the File field, type the full path of the virtual hard disk you want to create.  I entered C:\Disk02.vhd and click Next.

In the Size field, I entered 20000.  Enter what is appropriate for your witness disk.

Click Next.

Enter a description is necessary and click Next.

On the Access page, click Add.

Select the iSCSI target you created earlier.  In this case LUN-01 and click OK.

Click Next.

Click Finish.


Step 5: Connect the iSCSI target to Lab1

Perform the following proceeds on one of the Hyper-V servers that you will be clustering.  In this case, I am using the server named Lab1.

Click Start \ Administrative tools \ iSCSI Initiator.

Click Yes if prompted.

In the iSCSI Initiator Properties window, click the Targets tab.

In the Target field, enter the IP address of the iSCSI target.  In this case, it is the SAN-VM IP address of 192.168.1.115

image

Click Quick Connect.

The Status of the connection should be Done.

Click Done.

Click OK.


Step 6: Set up the volumes on the shared storage.
This procedure is being done on Lab1.

Open Server Manager.

Expand Storage and click Disk Management.

Located the 2 disks that are Unallocated. These are the two VHDs that you created on SAN-VM.  Notice the two different sizes.  The smaller one will be our witness disk and the larger one will be for the virtual machine.

image

Right click each disk and then click Online.

Right click one of the disks and select Initialize Disk

Make sure both disks are selected and click OK.

Right click the 7.81 GB disk and select New Simple Volume.

Click Next twice.

Provide the drive letter that you want to use for the witness disk.  For this demonstration, I am setting the drive to Q:.

Click Next.

Enter a volume label.  For this disk, I am entering Witness.  Click Next.

Click Finish.

In the Disk Management window, right click the 19.53GB disk and select New Simple Volume.

Click Next twice.

Provide the drive letter that you want to use for the witness disk.  For this demonstration, I am setting the drive to N:.

Click Next.

Enter a volume label.  For this disk, I am entering VM Storage.  Click Next.

Click Finish.


Step 7: Create an iSCSI target on Lab2

This procedure will be done on the second Hyper-V server to take part in the cluster.

Click Start \ Administrative Tools \ iSCSI initiator.

Click Yes if prompted.

In the Target: field type the IP address of SAN-VM (Your storage server ip address).  In this case, it is 192.168.1.115.

Click Quick Connect.

Click Done.

The status of the connection should be Connected.

Click the Volumes and Devices tab.

Click Auto Configure.  You should now see the two volumes.

image

Click OK to close the iSCSI Initiator Properties.


Step 8: Install Failover Clustering feature on both servers.
Perform this procedure on both servers that will be nodes in the cluster.  In this case, I will be performing it on LAB1 and LAB2.

Open Server Manager.

Click Features

Click Add Features

image

Check Failover Clustering and click Next.

Click Install.

Click Close when the installation completes.

Close Server Manager.

Remember, you must perform Step 8 on both servers that will be nodes in the cluster.


Step 9: Validate the cluster

The Failover Cluster Manager of Server 2008 has a feature to validate the cluster before you build it.  This feature will help to point out potential issues with the cluster before you commit to it.

On LAB1, click Start \ Administrative Tools \ Failover Cluster Manager.

In the Actions pane, click Validate a Configuration.

Click Next.

Click Browse.

Enter the names of the two servers, separated by a semicolon.

image

Click Check Names.

image

If all looks good, click OK.

Click Next

Select Run all test (Recommended) and click Next.

Click Next in the Confirmation window.

image

Let the test complete.  This will take some time.

Once the Validate a Cluster Wizard completed, review the report.  Warnings can be ignored in a test environment but should be addressed in a production environment.

Click Finish


Step 10: Create the Cluster

One Lab1, in the Failover Cluster Manager, click Create a Cluster in the Actions pane.

Click Next

Click Browse

Enter you’re the names of the servers that will be part of the failover cluster.  Separate the names with semicolons.  Click Check Names

Click OK

Click Next

On the Access Point for Administering the Cluster page, type in the Cluster Name field, Demo-Cluster (or any name that is appropriate).

Type in the IP address to be used for this cluster. I used 192.168.1.240

image

Click Next.

Click Finish.



Step 10: Enable the cluster shared volumes

In these next few sections, you will need to replace your FQDN with the ones that I am using.  From hear on out, we will say that my FQDN is ABCD.COM.

On Lab1, in the Failover Cluster Manager, expand. Demo-Cluster.ABCD.COM and then click Demo-Cluster.ABCD.COM.

On the right hand side in the Actions pane, click Enable Shared Volumes.

Select I have read the above notice and then click OK.


Step 11: Add one of your disks to the Cluster Shared Volume.

On the Failover Cluster Manager, right click Cluster Shared Volumes.

Click Add Storage.

Select Cluster Disk 2 (May be different for you).

Click OK.

In the Failover Manager, under Demo-Cluster.ABCD.COM click Cluster Shared Volumes

Expand Cluster Disk 2 and then verify it is using C:\ClusterStorage\Volume1 (Note: your exact path may be different.)


Step 12: Create a virtual machine in the cluster storage.

At this point you will create a virtual machine in accordance with your companies policy.  you will store the VM at C:\ClusterStorage\Volume1.

Once you build the virtual machine, open its properties.

Click Processor

Check Migrate to a physical computer with a different processor version.  This will allow the VM to fail over to a server that has a different processor.

image



Step 12: Configure your virtual machine to be able to fail over

On the Failover Cluster Manager, expand Demo-Cluster.ABCD.COM

Right click Services and applications and then select Configure a Service or Application.

Click Next

On this page, you select the application or service that you want to be able to failover.  Click Virtual Machine.

On the Select Virtual Machine page, check the name of your VM and click Next.

Click Next

Click Finish


Step 13:  Test the Live Migration of your virtual machine.

Start your virtual machine.

Open up event viewer or some other application and leave it on the screen.  You will use this to show that the VM did not shutdown or log off during the migration.

In the Failover Cluster Manager, right click your VM.

Point to Live migrate virtual machine to another node.

Click the option to live migrate the VM to your other node and then click Exit twice.

Monitor the server hosting the VM, it will change to the other server.

Open the Hyper-V manager on your other server and notice that your VM is running on it.

Comments

Popular posts from this blog

Adding a Comment to a GPO with PowerShell

As I'm writing this article, I'm also writing a customization for a PowerShell course I'm teaching next week in Phoenix.  This customization deals with Group Policy and PowerShell.  For those of you who attend my classes may already know this, but I sit their and try to ask the questions to myself that others may ask as I present the material.  I finished up my customization a few hours ago and then I realized that I did not add in how to put a comment on a GPO.  This is a feature that many Group Policy Administrators may not be aware of. This past summer I attended a presentation at TechEd on Group Policy.  One organization in the crowd had over 5,000 Group Policies.  In an environment like that, the comment section can be priceless.  I always like to write in the comment section why I created the policy so I know its purpose next week after I've completed 50 other tasks and can't remember what I did 5 minutes ago. In the Group Policy module for PowerShell V3, th

Return duplicate values from a collection with PowerShell

If you have a collection of objects and you want to remove any duplicate items, it is fairly simple. # Create a collection with duplicate values $Set1 = 1 , 1 , 2 , 2 , 3 , 4 , 5 , 6 , 7 , 1 , 2   # Remove the duplicate values. $Set1 | Select-Object -Unique 1 2 3 4 5 6 7 What if you want only the duplicate values and nothing else? # Create a collection with duplicate values $Set1 = 1 , 1 , 2 , 2 , 3 , 4 , 5 , 6 , 7 , 1 , 2   #Create a second collection with duplicate values removed. $Set2 = $Set1 | Select-Object -Unique   # Return only the duplicate values. ( Compare-Object -ReferenceObject $Set2 -DifferenceObject $Set1 ) . InputObject | Select-Object – Unique 1 2 This works with objects as well as numbers.  The first command creates a collection with 2 duplicates of both 1 and 2.   The second command creates another collection with the duplicates filtered out.  The Compare-Object cmdlet will first find items that are diffe

How to list all the AD LDS instances on a server

AD LDS allows you to provide directory services to applications that are free of the confines of Active Directory.  To list all the AD LDS instances on a server, follow this procedure: Log into the server in question Open a command prompt. Type dsdbutil and press Enter Type List Instances and press Enter . You will receive a list of the instance name, both the LDAP and SSL port numbers, the location of the database, and its status.