How to prepare and install Failover Clustering in Windows Server 2016

Failover Clustering it's a great tool to use it for High Availability in your environment. It's not easy the configuration but when you finish you will be safe from any issue that can be have in your HYPER-V Hosts.

I thought that will be useful all the steps which need to create the Failover Clustering so i publish this article today.

So let's start

 

Why to install Failover Clusters in Windows Server 2016

Failover Cluster is a group of Servers that work together to increase the availability and scalability. 

Let's imagine that you have a single HYPER-V Host with 10 Virtual Machines.

One day the HYPER-V Host is dead for an unknown reason. What you will do in this scenario?

So the only one reason to use Failover Clusters is for the High Availability.

 

Which are the Failover Cluster requirements

Before begin to implement  Failover Clusters you must think lot of thinks that you must have in place:

  • At least 2 Servers with exactly the same hardware requirements.
  • HYPER-V Hardware Requirements 
  • Windows Server 2016 Datacenter  Licenses
  • Share Storage to store the Virtual Machines
  • At least 2 Network Cards in each Server  
  • Failover Clusters must join in a Domain

When you have in place all the staff that required let's start

Of course you must install in both Server the Windows Server 2016 Datacenter Core Edition

 

Lab Design

Because i don't have the resources for 2 Physical Servers with 2 Network Cards each one i will use Nested Virtualization in HYPER-V Host with Virtual Network Cards to isolate the traffic which will represent the Physical Cards.

  • 1 HYPER-V Host with Windows Server 2016 Datacenter Edition
  • 2 Virtual Machines with Windows Server 2016 DataCenter Core Edition as Failover Clusters with Nested Virtualization
  • 1 Virtual Machine as iSCSI Target Server with Windows Server 2016 Standard Core Edition
  • 4 Virtual Network Adapters in each Virtual Machine to separate the traffic of Storage,Heartbeat and Virtual Machines

The Server Names as follow

  • The SRCL01 and SRCL02 will be the Nodes which create the Failover Clustering
  • The FILE 1 will be the iSCSI Targer Server
  • The Management Server will be the Server that Manage the above Servers

 

In a Production Environment the recommendation is to use at least 1 Physical Network Interface in different VLAN to conenct with your Storage only for the Storage Communication.

 

How to create a VM to manage the Nodes

Because all the nodes has Core Edition it's prefer to have a VM to manage the nodes with Windows 10 or Windows 2016.

I prefer a Windows Server 2016 Standard Edition .

  • Before try to manage the Nodes you must disable the Windows Firewall. Because i am in Lab environment i will disable the Window Firewall. In a Production environment it's recommended to open the specific ports.
  • Type the following command in Powershell to Disable the Windows Firewall in both nodes.
    Set-NetFirewallProfile -Profile Domain -Enabled false
  • Now login in the VM which want to manage the Nodes and Open the Server Manager
  • From the left side right click in All Servers and click Add Server

 

  • Type the name of the Node and click Find Now

 

  • Select the Server and click in Arrow

 

  • Do the same for the other Server and click OK

 

 

How to install a HYPER-V Role 

If you have Physical Servers that will use it in your Production environment the first step is to install HYPER-V Role in both Servers

  • Open Powershell in your Management VM and type the following command. Replace the computer names.
  • Wait until finish the installation and do the restart

Invoke-command -ComputerName SRCL01,SRCL02 -ScriptBlock {Install-WindowsFeature -Name hyper-v -IncludeAllSubFeature -Restart}

 

If you try to create a Failover Clustering in your Lab environment it's not the first priority but optional you can install the HYPER-V Role.

 

 

Install iSCSI Target Server Role

Because we are in a Nested Virtualization environment we can't use a NAS when we want to isolate the traffic in different VLANs.

For this reason we have create an iSCSI Target Server for the share storage that will use to store the Virtual Machines every Node.

So let's start

  • From the Server Manager right click in the FILE1 and select Add Roles and Features

 

  • Click Next

 

  • Select Roled-based or feature based installation

 

  • Select the File1 Server

 

  • Expand the File and Storage Services

 

  • Check the iSCSI Target Server. Click Next

 

  • Click Next.

 

  • Click Install and Wait Until finish

 

 

Failover Custer Network Configuration

In order to proceed with Failover Clustering you must work with Network configuration to isolate the different types of traffic.

We must create the following Network Interfaces in every node 

  • Management = Network to use it for the management of the Nodes
  • Storage= Network for the communication between nodes and iScsi Storage
  • Cluster Heartbeat= Network for the communication between the Clusters 
  • VM = Network dedicated to HYPER-V only for the Virtual Machines

The networks that i will use in my environment are the followings:

  • Management =192.168.50.0/24
  • Storage=192.168.54.0/24
  • Cluster Heartbeat=192.168.52.0/24
  • VM=192.168.53.0/24

Note that only one network must has a gateway to go in outside world and this is must be the Management. 

So let's start the game

  • Select he first Node and click Settings from the HYPER-V Manager
  • In Add Hardware select the Network Adapter and click Add

 

  • Select the Virtual Switch.
  • Check the Enable Virtual Lan Identification
  • Type the VLAN ID that will use for every network.
  • This network will be for the Storage with VLAN ID 54.

 

  • Create 2 more Network Adapters for Cluster Heartbeat and VM in the appropriate VLAN ID
  • Do the same in the 2nd Node that will use for the Failover Cluster
  • Also in the iSCSI Targer Server create only one Network Adapter for the Storage with the same way.
  • Now we must give ip addresses for every Network Adapter in each Server.
  • From the Management Server open the Powershell as Administrator 
  • Connect in the first node SRCL01 with
    Enter-PSSession SRCL01
  • View all Network Adapters details
    Get-NetAdapter
  • To be sure in which Network Adapter you will give the right ip address select one of them and see the MAC Address

 

  • Now go back in the HYPER-V Manager.
  • Go in Settings of the SRCL01
  • Expand one of the Network Adapters and click in Advance Features.
  • Check the  MAC Address and see if are the same . When you find the appropriate MAC Address go back in Powershell

 

  • Type the following command to give an ip address. 
    New-NetIPAddress -InterfaceIndex 23 -IPAddress 192.168.54.2 -PrefixLength 24

 

  • Follow the same procedure to give ip address in all Network Adapters in each Server

To verify that all your networks can communicate between the Servers try to ping every ip address from one Server to another Server in the appropriate network.

 

Failover Cluster Storage Configuration

After create and configure the Network for the Servers it's time to proceed with the Storage Configuration.

We must create the iSCSI Conenctions in the iSCSI Target Server or every type of Storage that you will use to store the Virtual Machines

  • First type the following command from Management Server to start the Microsoft iscsi Initiator Service in both Nodes and add Automatic the Start Type
    Invoke-Command -computername srcl01,srcl02 -scriptblock {start-service -name msiscsi | set-service -startuptype automatic}
  • Now from the Server Manager right click in each of the Server and select Computer Management.

 

  • Go in Services and verify that the Microsoft iSCSI Service is Running and is in Automatic. It's very important this detail because the Service by default is in Manual. So it's not change it to Automatic and sometime restart the Node then it will not connect with the Storage.

 

 

  • Now from the Management Server open Powershell as Administrator and run the following command
    Enter-Pssession <node1>
  • Verify that you can ping the iSCSI Target Server in the VLAN that you will use for the storage
    ping 192.168.54.5
  • Connect the iSCSI Target Server
    New-IscsiTargetPortal -TargetPortalAddress 192.168.54.5 -InitiatorPortalAddress 192.168.54.1

 

  • Update the iscsi target in the Node.
    Get-IscsiTargetPortal | Update-IscsiTargetPortal
  • Get the Node Address to use it in the next step
    Get-IscsiTarget

 

  • Now go back in the Server Manager of the Management Server
  • Select the iSCSI Target Server and click in iSCSI from the left menu
  • Click on create an iSCSI Virtual Disk ....

 

  • Select the Volume that will use as storage for the VM. For the scenario i create 60GB Partition but in reality will be much more

 

  • Give a name for the Lun

 

  • Select Fixed Size and give the Size that you want to have the specific LUN

 

  • Leave as it and click Next

 

  • Give a name as target for the LUN that will use it to connect the initiators with the specific target.

 

  • Click Add

 

  • Select the Targets of every Initiator  which are the Nodes that we configure before and click Add one by one.

 

  • Click Next .

 

  • We don't want to enable CHAP

 

  • Click Create and in few minutes will be ready.

 

  • Now go back in Powershell command.
  • Create the connection of the Iscsi Target with the Initiator which is the Node and enable MPIO and Persistent which mean to automatic connect after restart. If you don't use the -IsPersistent $true after restart the IscsiTarget will not connect in the Initiator and you will have big problem in your Production
    Get-IscsiTarget -NodeAddress iqn.1991-05.com.microsoft:file1-lun1-target | Connect-IscsiTarget -TargetPortalAddress 192.168.54.5 -InitiatorPortalAddress 192.168.54.2 -IsMultipathEnabled $true -IsPersistent $true

 

  • Run exactly the same steps to connect the iSCSI Storage in the 2nd Node
  • Now go back again in the Management Server and open the Server Manager
  • Select the FILE1 Server and click in Disks from the left menu
  • Be careful here because we will Bring Online the new iSCSI Disk which created before but only on one of 2 Servers for now.
  • Right click in the new iSCSI Disk from the SRCL01 and select Bring Online.

 

  • Click Yes

 

  • Right click again and select Initialize.

 

  • Click again Yes

 

  • Right click again and select New Volume

 

  • Click Next

 

  • Again Next

 

  • Select the SRCL01 and click Next.

 

  • Use all the Size and click Next

 

  • Select a Drive Letter and click Next

 

  • Select the File System and you want to use between NTFS and REFS and click Next.

 

  • Click Create and wait until finish

 

 

Now we are ready to install the Failover Clusters Role and Validate the Configuration.

 

How to install and Create the Failover Clusters

After configure Network and Storage the last step is to instal Failover Cluster Role and Validate the Configuration.

The Validation is a test to identify if all the above configuration are the right to support the Failover Clustering.

  • Open Powershell as Administrator from Management Server and type the following command to install the Failover Clustering Role
    Invoke-Command -ComputerName srcl01,srcl02 -ScriptBlock {Install-WindowsFeature -Name  Failover-Clustering -IncludeAllSubFeatur
    e -Restart}

 

  • After finish type the following command to install the Failover Cluster Management Tools in the Management Server
    Install-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

 

  • Now from the Server Manager click Tools - - Failover Cluster Manager
  • Click in Validation Configuration

 

  • Click Next

 

  • Add the 2 Nodes and click Next

 

  • Select Run all Tests and click Next

 

  • The test can take lot of time so just relax until finish
  • If the test finish successful without errors check the Create the Cluster now using the validation Nodes and click Next

 

  • Now start the Create Cluster Wizard and click Next

 

  • Add a name in Cluster Name which will be an Access Point for the Administrative the Cluster.
  • Give an available IP Address.
  • This will create a Computer Object in the Active Directory which must not be deleted.Click Next

 

  • Click Next in the Confirmation before create the Failover Clustering

 

  • Click Finish to start create the Failover Clustering.

 

  • It will take some time.
  • When will finish you will see the name of the Access Point in the Failover Cluster Manager
  • Expand and you will see a lot of Options.

 

 

How to create the LUN for the Qurum Witness

After finish the Validation of the Failover Clustering without errors it's time to create a small LUN in the FILE1 for the Witness

  • From the FILE1 (iSCSI Target Server) open the Server Manager
  • Select the FILE1 (iSCSI Target Server)
  • Select iSCSI
  • Right click and select New iSCSI Virtual Disk

 

  • Select the Server FILE1 and the Volume that you want to use.

 

  • Type a name. I prefer a name to understand which are located in the disk

 

  • For quorum use Fixed size..

 

  • Click Add to add both initiators.

 

  • Every iSCSI inititator comes from the Node.

 

  • Don't enable authentication

 

  • Click Create 

 

Now you must connect the Target with the initiator as describe in the following paragraph

 

How to create ISCSI Connections with the Target in your Nodes

Now we must connect the LUN with iSCSI Connection in bothe Nodes.

  • Connect with Enter-PSsession in first node.

  • Type Get-iScsiTarget to bring the Target Names.
  • Now identify the target name which is False in field Is Connected and copy the Name
  • Type the following command to do the connection. 
  • Just change -NodeAddress  -TargetPortalAddres and -InitiatorPortalAddress with your names and ip addresses.
    Get-IscsiTarget -NodeAddress iqn.1991-05.com.microsoft:file1-quorum-target | Connect-IscsiTarget -TargetPortalAddress 192.168.54.5 -InitiatorPortalAddress 192.168.54.1 -IsMultipathEnabled $true -IsPersistent $true

 

  • Type again Get-IscsiTarget to verify that the connection is done. If the Value is True in the IsConnection field then the iscsi conenction created.

 

 

  • Connect in the second Node and follow the above steps to create the connection.

 

How to create the Volume in the Nodes for the Quorum Witness

  • After create succesfull the connection go back in the Management Server 

  • Open Server Manager. Select FILE1 (iSCSI Target Server) and click in Disks.

  • Now you can see 3 disks in every Node.
  • Recognize the quorum disk. Right click and select Bring Online

 

  • Click Yes

 

  • Again right click in the Disk and select Initialize
  • Click Yes
  • Right click and select New Volume
  • Click Next in the Welcome Wizard

 

  • Select the Server and the Disk which initialize before and click Next

 

  • Click OK

 

  • Type the Volume Size. Most of the times use all the size

 

  • Select the Drive Letter and type the Label of your Volume

 

  • Specify the file system and the Volume Label

 

  • Confirm all your settings and click Create

 

  • When finish click Close

 

Now it's time to create the Quorum Witness to improve the High Availability of the Failover Cluster.

 

How to Add the Disk in Failover Cluster

Let's go to add the disk Witness in Share Storage so you can configure in the following step

  • Open Failover Cluster Manager

  • Expand Storage and right click on Disks
  • Select Add Disk

 

  • Check the available Disk which is the only one and click OK

 

 

How to Configure Cluster Quorum in Failover Cluster

Now it's time to create the Witness and improve high availability in our Failover Cluster

  • From the Failover Cluster Manager right click in Administration Access Point

  • Select More Actions--Configure Cluster Quorum Settings

 

  • Click Next in the Welcome Wizard

 

  • Click in Select the quorum witness

 

  • Check in Configure a disk witness

 

  • Select the Cluster Disk which add in the above paragraph.

 

  • Just click Next in the Confirmation

 

  • Click Finish

 

  • That's it..
  • Go in Disks and see that in the Assign To says Disk Witness in Quorum.

 

It's important to know that the specific disk you can't added to the Cluster Share Volume Disk.

How to add storage to the Cluster Share Volume Disk

The last step before start to create Roles in your Failover Cluster.

  • From the Failover Cluster Manager

  • Expand Storage -- Disks
  • Right click in the disk which want to add and select Add to Cluster Share Volumes

 

How to add a Role in the Failover Cluster

Now it's time to start Add Roles in your Failover Cluster.

  • From the Failover Cluster Manager Right click in Roles and select -- Virtual Machines -- New Virtual Machine.

 

  • Select the node that you want to create the Virtual Machine

 

  • Click Next in the Welcome Wizard

 

  • Type the name of the Virtual Machine and select the Virtual Machine Location. Because you have a Cluster Storage Volume you must select the path C:\ClusterStorage\.... . In this scenario the exactly path is C:\ClusterStorage\Volume1 but this depends from your installation.

 

  • Specify the Generation and click Next

 

  • Assign the Memory of the VM and click Next

 

  • I leave Not Connecting for now the VM but you can change it if you want

 

  • Create the virtual hard disk now or later if you want. You must remember that if create the virtual disk now will be dynamic and the location of your virtual hard disk must be the C:\ClusterStorage\...\vmname.

 

  • Decide if you want to install the OS now or later.

 

  • Click Finish in the Summary.

 

  • Now you can see your first Virtual Machine in the Failover Cluster.

 

Check High Availability of your Virtual Machines

All is good until now. What about to check if the Failover Cluster working and has the High Availability that you want in your Virtual Machines?

Let's check it !!!

  • From the Failover Cluster Manager click in Nodes
  • Right click in one of two nodes and select More Actions -- Stop Cluster Service
  • Go in the Roles and see if your VM is up. 
  • If the VM is up then congrats !!!!

 

After all these i hope to create a Failover Cluster succesfull and improve your High Availability of your environemnt.

Now let's start to transfer or create new Virtual Machines 

 

Have a nice weekend !!!