Share via


Configuring Failover Cluster In Windows Server 2012 Hyper-V

 

A failover cluster is a group of two or more computers working together to increase the availability of services or applications. To make virtual machines highly available in Hyper-V environment, you must implement failover clustering on the Hyper-V host servers.

** **

In this article, I will show you how to build a two-node failover cluster using iSCSI SAN storage on Windows Server 2012.

 

In my LAB I use three computers

- DC2012 (IP Address: 172.16.0.10): Domain Controller (domain mcthub.local) running Windows Server 2012. This computer will hold iSCSI target server role

***- HOST1 (IP Address: 172.16.0.31): ***Domain Member running Windows Server 2012, this computer has been installed Hyper-V role

***- HOST2 (IP Address: 172.16.0.32): ***Domain Member running Windows Server 2012, this computer has been installed Hyper-V role

 

On both Hyper-V servers (HOST1 and HOST2), you need to define previously a external virtual switch named External Network mapped to the physical network adapter

 

Steps to implementing Windows Server 2012 Hyper-V Failover Clustering:

1- Configure shared storage (iSCSI Target)

2- Connect to iSCSI target from both host Hyper-V servers

3- Install Failover Cluster

4- Create necessary volumes for Failover Cluster

5- Create Failover Cluster

6- Add disk to Failover Cluster

7- Performing Cluster Validation Tests

8- Create virtual machine in Cluster

9- Testing the Failover Cluster

 

1- Configure Shared Storage (iSCSI Target)

Because a failover cluster  need to connect to connect to a shared Storage to operate, so before configure failover cluster you need to configure a appropriate storage. On Windows Server 2012 has a built-in service is iSCSI SAN Storage Service.

On DC2012,  you must install  iSCSI Target server.

http://mcthub.com/images/ContentLab/FailOver-En_files/image001.jpg

 

Next, I will create three iSCSI Virtual Disk. Open Server Manager - Select File and Storage Services - Select iSCSI - On the  iSCSI VIRTUAL DISK session - Select Task - New iSCSI Virtual Disk

http://mcthub.com/images/ContentLab/FailOver-En_files/image002.jpg

 

Choose a partition so much space on this server, I choose E: drive- Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image003.jpg

 

Enter a name for iSCSI Virtual Disk: Disk1 - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image004.jpg

 

I specified the disk space is 30B - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image005.jpg

 

Because I have not created iSCSI Target, so I  select New iSCSI target to create a new iSCSI Target  - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image006.jpg

 

Enter a name for iSCSI Target: Target1 - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image007.jpg

 

Click Add to specify iSCSI Initiators (iSCSI Initiators is the computers, that I allow to connect to the ISCSI target to use the disks of iSCSI target)

http://mcthub.com/images/ContentLab/FailOver-En_files/image008.jpg

 

Select  ***Enter a value for the selected type ***radio button: Select IP Address from drop-list và type HOST1's IP address is 172.16.0.31 - Click OK

http://mcthub.com/images/ContentLab/FailOver-En_files/image009.jpg

 

Do the same to add HOST2's IP Address is 172.16.0.32 to the list - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image010.jpg

 

On ***Enable Authentication ***page: Because I do not need to use any authentication method, so I bypass this page - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image011.jpg

 

Click Create

http://mcthub.com/images/ContentLab/FailOver-En_files/image012.jpg

 

Click Close when finished

http://mcthub.com/images/ContentLab/FailOver-En_files/image013.jpg

 

Verify iSCSI Virtual Disk and iSCSI Target has been created, it look like the image below

http://mcthub.com/images/ContentLab/FailOver-En_files/image014.jpg

 

Perform the same steps previously,  you create 2 iSCSI Virtual Disks (Disk2 and Disk3) have the same capacity and join them to existing iSCSI Target you have created previously (Target1)

http://mcthub.com/images/ContentLab/FailOver-En_files/image015.jpg

 

Verify the iSCSI virtual disks and iSCSI target will be displayed look like the image below

http://mcthub.com/images/ContentLab/FailOver-En_files/image016.jpg

** **

2- Connect to iSCSI target from both host Hyper-V servers

To use iSCSI virtual disks that you created in step 1, both two nodes need to be connected to iSCSI Target. On both HOST1 and HOST2 you make connections to iSCSI Target by implementing following steps

 

Open iSCSI Initiator

http://mcthub.com/images/ContentLab/FailOver-En_files/image017.jpg

 

Click Yes to start the ***Microsoft iSCSI service ***service

http://mcthub.com/images/ContentLab/FailOver-En_files/image018.jpg

 

On Target box:  Type IP address of the iSCSI Target Server (DC2012): 172.16.0.10 - Click Quick Connect

http://mcthub.com/images/ContentLab/FailOver-En_files/image019.jpg

 

Verify status of connection: Status column displayed Connected - Click Done

http://mcthub.com/images/ContentLab/FailOver-En_files/image020.jpg

 

Click OK

http://mcthub.com/images/ContentLab/FailOver-En_files/image021.jpg

 

3- Install Failover Cluster

On both Hyper-V servers (HOST1 và HOST2) you need to install Failover Clustering feature. Open Server Manager - Select Manage - Add Roles and Features

http://mcthub.com/images/ContentLab/FailOver-En_files/image022.jpg

 

In the previous pages, accept the default value, on ***Select Features ***page: Select ***Failover Clustering. ***Then proceed with the installation by accepting the default values

http://mcthub.com/images/ContentLab/FailOver-En_files/image023.jpg

 

 

4- Create necessary volumes for Failover Cluster

 

On HOST1, open Disk Management (DISKMGMT.MSC) you'll see 3 new disks. Right-click on Disk 3, and then click Online

http://mcthub.com/images/ContentLab/FailOver-En_files/image024.jpg

 

Right-click on Disk 3, and then click Initialize Disk

http://mcthub.com/images/ContentLab/FailOver-En_files/image025.jpg

 

On Disk3, Right-click on the unallocated space, and then click New Simple Volume.

http://mcthub.com/images/ContentLab/FailOver-En_files/image026.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image027.jpg

 

On the Specify Volume Size page, click Next.
http://mcthub.com/images/ContentLab/FailOver-En_files/image028.jpg

 

On the Assign Drive Letter or Path page, click Next.

http://mcthub.com/images/ContentLab/FailOver-En_files/image029.jpg

 

On the Format Partition page, in the Volume label box, type ClusterDisk1. Select the Perform a quick format check box, and then click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image030.jpg

 

Click Finish

http://mcthub.com/images/ContentLab/FailOver-En_files/image031.jpg

 

If a dialog box asking you to format the disk appears, click Cancel. Verify first volume has been formatted.

http://mcthub.com/images/ContentLab/FailOver-En_files/image032.jpg

 

Do the same process on remaining Disk4 and Disk5, you must to create 2 simple volume on Disk4 and Disk5 (ClusterDisk2 and ClusterDisk3). After completed, the result will look like the image below

http://mcthub.com/images/ContentLab/FailOver-En_files/image033.jpg

 

Switch to HOST2, open Disk Management,  Select ***Action ***menu then click Refresh

http://mcthub.com/images/ContentLab/FailOver-En_files/image034.jpg

 

Turn to the new disk to online status http://mcthub.com/images/ContentLab/FailOver-En_files/image035.jpg

 

Verify that on HOST2, three new disks look like the image bellow

http://mcthub.com/images/ContentLab/FailOver-En_files/image036.jpg

 

5- Create Failover Cluster

Switch back to HOST1, open Failover Cluster từ Server Manager and create a new Failover Cluster.

http://mcthub.com/images/ContentLab/FailOver-En_files/image037.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image038.jpg

 

Alternately add 2 servers (HOST1 and HOST2)  to the Selected servers list http://mcthub.com/images/ContentLab/FailOver-En_files/image039.jpg

 

A page asks you to validate the cluster, select No… (I will validate later)

http://mcthub.com/images/ContentLab/FailOver-En_files/image040.jpg

 

Enter a name for cluster and specify a IP address for Cluster - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image041.jpg

 

Clear the Add all eligible storage to the cluster check box, I will add storage later - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image042.jpg

 

Wait for the process of creating Cluster

http://mcthub.com/images/ContentLab/FailOver-En_files/image043.jpg

 

Click nút Finish when finished

http://mcthub.com/images/ContentLab/FailOver-En_files/image044.jpg

 

6- Add disk to Failover Cluster

On HOST1, add the disks to the Failover Cluster

http://mcthub.com/images/ContentLab/FailOver-En_files/image045.jpg

 

Select all disks - Click OK

http://mcthub.com/images/ContentLab/FailOver-En_files/image046.jpg

 

Check that all disks was included in cluster and Assign To column displayed Available Storage

http://mcthub.com/images/ContentLab/FailOver-En_files/image047.jpg

 

Enabling Cluster Shared Volumes. Right-click on ClusterDisk1 and then select Add to Cluster Shared Volume

http://mcthub.com/images/ContentLab/FailOver-En_files/image048.jpg

 

Do the same process for ClusterDisk2

http://mcthub.com/images/ContentLab/FailOver-En_files/image049.jpg

 

Verify that ClusterDisk1 and ClusterDisk2 will be changed to Cluster Shared Volume.

http://mcthub.com/images/ContentLab/FailOver-En_files/image050.jpg

 

Configure Quorum configuration. Right-click on Cluster's name- Select More Action - Configure Cluster Quorum Settings

http://mcthub.com/images/ContentLab/FailOver-En_files/image051.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image052.jpg

 

Select Use typical settings - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image053.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image054.jpg

 

Click Finish

http://mcthub.com/images/ContentLab/FailOver-En_files/image055.jpg

 

Verify that ClusterDisk3 will be changed to Disk Witness Quorum

http://mcthub.com/images/ContentLab/FailOver-En_files/image056.jpg

 

7- Performing Cluster Validation Tests

Switch to HOST2, right-click on name of Failover Cluster - Select Validate Cluster

http://mcthub.com/images/ContentLab/FailOver-En_files/image057.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image058.jpg

 

Select Run all test to check out all the requirements  - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image059.jpg

 

Select all disks - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image060.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image061.jpg

 

Waiting for test process, this process can take a long time

http://mcthub.com/images/ContentLab/FailOver-En_files/image062.jpg

 

During the test, on HOST1 you will see the disks being converted into Offline status***, ***this is perfectly normal, you should not worry about it

http://mcthub.com/images/ContentLab/FailOver-En_files/image063.jpg

 

Wait a while on HOST1 you will see the disks being converted into Online status.

http://mcthub.com/images/ContentLab/FailOver-En_files/image064.jpg

 

Switch back to HOST2, when finished , Click View Report to view the report for more detail

http://mcthub.com/images/ContentLab/FailOver-En_files/image065.jpg

 

Close the report to continue

http://mcthub.com/images/ContentLab/FailOver-En_files/image066.jpg

 

Click Finish

http://mcthub.com/images/ContentLab/FailOver-En_files/image067.jpg

 

8- Create virtual machine in Cluster

Switch back to HOST1, copy a VHD file which is contain a operating system

http://mcthub.com/images/ContentLab/FailOver-En_files/image068.jpg

 

Open C:\ClusterStorge\Volume1 folder (this folder is the first volume in the storage system), create a folder to contain virtual machine (I created ***SERVERCORE ***folder)

http://mcthub.com/images/ContentLab/FailOver-En_files/image069.jpg

 

Then paste it to **SERVERCORE **folder

http://mcthub.com/images/ContentLab/FailOver-En_files/image070.jpg

 

Create a new virtual machine in the cluster

http://mcthub.com/images/ContentLab/FailOver-En_files/image071.jpg

 

Select HOST2 node - Click OK

http://mcthub.com/images/ContentLab/FailOver-En_files/image072.jpg

 

Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image073.jpg

 

Type SERVERCORE for the name, and then click Store the virtual machine in a different location and then click Browse. And select C:\ClusterStorage\Volume1\SERVERCORE and click Next.

http://mcthub.com/images/ContentLab/FailOver-En_files/image074.jpg

 

Type 2048 for startup memory and then click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image075.jpg

 

Select External in Connection drop-down menu and click Next.

http://mcthub.com/images/ContentLab/FailOver-En_files/image076.jpg

 

Select Use an existing virtual hard disk - Click Browse and choose the VHD file you copied earlier - Click Next

http://mcthub.com/images/ContentLab/FailOver-En_files/image077.jpg

 

Click Finish

http://mcthub.com/images/ContentLab/FailOver-En_files/image078.jpg

 

Click Finish

http://mcthub.com/images/ContentLab/FailOver-En_files/image079.jpg

 

Start the virtual machine. Right-click on SERVERCORE virtual machine - click Start

http://mcthub.com/images/ContentLab/FailOver-En_files/image080.jpg

 

Connect to the virtual machine. Right-click on SERVERCORE virtual machine - click Connect

http://mcthub.com/images/ContentLab/FailOver-En_files/image081.jpg

 

Waiting for virtual machine to boot completely

http://mcthub.com/images/ContentLab/FailOver-En_files/image082.jpg

 

Logon to virtual machine

http://mcthub.com/images/ContentLab/FailOver-En_files/image083.jpg

 

9- Testing the Failover Cluster

There are two ways to see failover in action on a Hyper-V failover cluster. The first is to simulate a failure and is called an Unplanned Failover. The second is to perform the Live Migration, which is called Planned Failover

 

Simulating an Unplanned Failover

 

Switch to HOST1, verify that SERVERCORE is owned by HOST2

http://mcthub.com/images/ContentLab/FailOver-En_files/image084.jpg

 

Switch to HOST2, disable network adapter to simulate this machine broken

http://mcthub.com/images/ContentLab/FailOver-En_files/image085.jpg

 

Switch back to  HOST1, you'll see status of HOST2 is Down, wait for a while you'll see owner of SERVERCORE automatically change to HOST1, this might take a short delay while this process,*** ***and of course, then you can connect to virtual machine and use it normally, The services is hosted on a virtual machine can be interrupted for a short time in the process of changing owner.

http://mcthub.com/images/ContentLab/FailOver-En_files/image086.jpg

** **

Planned Failover (Live Migration)

Switch to HOST2, enable network adapter

http://mcthub.com/images/ContentLab/FailOver-En_files/image087.jpg

 

Switch back to HOST1, open Failover Cluster, select Nodes and verify status of both nodes is*** Up***

http://mcthub.com/images/ContentLab/FailOver-En_files/image088.jpg

 

Verify that SERVERCORE virtual machine is owned by HOST1

http://mcthub.com/images/ContentLab/FailOver-En_files/image089.jpg

 

To test a planned failover, we can move the virtual machine from one node to another node. Here HOST1 to HOST2. Here, I'm using Live Migration option for Test a Planned Failover. To perform the Live Migration, in Failover Cluster Manager, Expand Nodes, Right-Click on the SERVERCORE virtual machine, click Move and select to Live Migration and click Select Node

http://mcthub.com/images/ContentLab/FailOver-En_files/image090.jpg

 

Select HOST2 - Click OK

http://mcthub.com/images/ContentLab/FailOver-En_files/image091.jpg

 

Live Migration process started and keep track of the migration status in Failover Cluster Manager

http://mcthub.com/images/ContentLab/FailOver-En_files/image092.jpg

 

When finished, SERVERCORE virtual machine will be owned by HOST2

http://mcthub.com/images/ContentLab/FailOver-En_files/image093.jpg

 

Connect to SERVERCORE virtual machine

http://mcthub.com/images/ContentLab/FailOver-En_files/image094.jpg

 

Logon and type IPCONFIG command to view IP Address of virtual machine

http://mcthub.com/images/ContentLab/FailOver-En_files/image095.jpg

 

Switch back to  HOST2 perform continuous testing connections to virtual machines by using Ping -t

http://mcthub.com/images/ContentLab/FailOver-En_files/image096.jpg

 

Switch to HOST1 and stop ***Cluster ***service

http://mcthub.com/images/ContentLab/FailOver-En_files/image097.jpg

 

Click Yes

http://mcthub.com/images/ContentLab/FailOver-En_files/image098.jpg

 

Check that the ping command is not interrupted http://mcthub.com/images/ContentLab/FailOver-En_files/image099.jpg

 

On HOST2 you can connect to and use the virtual machine normally

http://mcthub.com/images/ContentLab/FailOver-En_files/image100.jpg

 

http://mcthub.com/images/ContentLab/FailOver-En_files/image101.jpg

 

Thank you for reading my article

To view my article in Vietnamese, click the link below
mcthub.com

 

 

 

 

By Đồng Phương Nam