Proxmox/Hyper-V/VMware

How to install and configure Hyper-V Cluster On Windows Server via PowerShell and Server Manager

Cluster

A Failover Cluster is a group of independent devices that work together to increase the availability of applications and services. The clustered nodes are connected by physical cables and by software. If one of the cluster nodes fails, another node begins to provide service (a process known as failover). Microsoft Failover Clustering is always in an active/passive configuration. This means that any single role can only operate on a single cluster node at any given time. A cluster can operate multiple roles simultaneously, however. Depending on the role type, it may be possible for roles to operate independently on separate hosts. As this specifically applies to Hyper-V, an individual virtual machine is considered a role, not the entire Hyper-V service. Therefore, a single virtual machine (VM) can only run on one Hyper-V host at any given time, but each host can run multiple virtual machines simultaneously. If a host crashes, all of its virtual machines will also crash, but they will be automatically restarted on another cluster host. Because a virtual machine cannot run on two hosts simultaneously, Hyper-V virtual machines are not considered fault-tolerant. Installing the Hyper-V cluster ensures highly available and scalable Hyper-V production workloads in the organization network. See the following guides on how to set up a VM via PXE boot on a Generation 1 VM and how to set up a VM via PXE boot on a Generation 2 VMhow to deploy images to computers or virtual machines using WDS and Windows deployment cannot continue, the operating system is missing via MDT deployment.

Hyper-V role can be installed via the following ways: PpowerShell, Dism.exe, and Server Manager. Here we will share the steps for power shell and a dism. Kindly refer to this guide: How to install and Configure Hyper-V on Windows Server on Windows Server 2019, and 2022 via the Server Manager, PowerShell or DISM. Here is a guide on how to install "How to install free Hyper-V Server in Core Mode on a VMware Workstation". Here is a guide on how to install "How to install free Hyper-V Server in Core Mode on a VMware Workstation".

Now we have installed the Hyper-V role on both Hyper-V hosts. We need to install the Failover Clustering feature on both servers in our lab. You may want to see the hardware requirements and storage options for failover clustering. Perform the below steps on the Windows Server prior to installing Hyper-V and configuring Failover Clustering.
– Ensure all necessary patches are applied (Windows Update), ensure the right PC Name is used, configure Basic networking,
– Ensure the device is domain-joined.

If you do not have a new Server, you can clone an existing VM and Sysprep it to get rid of the system-specific information. Here is a guide on how to do it “How to Clone and Sysprep (generalize ) a Windows Server running on VMware Workstation“. Here are some other articles that might interest you: Sysprep (Generalize) a Windows installation: How to perform Sysprep in Windows, and how to clone a Windows Server running on VirtualBox.

Part 1 – Installing the Failover Clustering: Access the first (1st) Hyper-V node. If you wish you can install Hyper-V Clustering via PowerShell: This is the quickest way to set up a failover cluster feature on the Hyper-V servers. 

Install-WindowsFeature Failover-Clustering –IncludeAllSubFeature –IncludeManagementTools 
Screenshot-2021-07-10-at-14.40.43

Access the second (2nd) Hyper-V node: On the second server, also install the HyperV cluster feature. There are quite a few different ways to add the HyperV roles via the Server Manager.
– You can either click on the Local Server, then click on Manage and finally, click on Add Servers and features.
– Alternatively, click on the Dashboard on the Server Manager and Click on Add roles and features.

On the “Before you begin” page, you can just click on Next. If you do not want the page to appear subsequent times, check the button to skip the page by default.

Screenshot-2021-07-08-at-20.26.40

On the next Window “Select installation type“, select “Role-based or feature-based installation” and click on “Next“.

Screenshot-2021-07-08-at-20.27.03

If you have multiple servers, please ensure you select the right server to have the Failover Cluster installed.
– I only have one server, therefore it is selected by default.

Screenshot-2021-07-08-at-20.27.24

As you can see below, I have already previously installed the hyper Role. Therefore, on this screen, I will be skipping this window.

Screenshot-2021-07-08-at-20.28.40

Select the Failover Clustering feature and a new window will be promoted

Screenshot-2021-07-08-at-20.29.26

On the “Add the features that are required for Failover Clustering”, click on Add Feature

Screenshot-2021-07-08-at-20.29.47

As we can see, the feature is selected. Click on Next to continue.

Screenshot-2021-07-08-at-20.30.02

Click the install button. For this, the “Restart the destination server automatically if not required”. Just click on “Restart the destination server automatically if required” so you know how it works.

Screenshot-2021-07-08-at-20.31.11

Note: Restart is not required for this installation but I just want to show you how to do this. Upon clicking on “Restart the destination server automatically if required”, you will be prompted to select Yes or No if you wish to automatically restart.

Screenshot-2021-07-08-at-20.31.38

On this window, just click on “Install”, this will ensure the Failover Clustering is installed onto the server.

Screenshot-2021-07-08-at-20.32.16

As you can see, the Failover Clustering is currently being installed. You can click on close at this point.

Failover Clustering has Failover Cluster Manager. This tool is used to create and maintain failover clustering. It deals with roles, nodes, storage, and networking for the cluster. The tool itself is not specific to Hyper-V, but it does share much of the same functionality for controlling virtual machines.

Part 2 – Validate a Hyper-V Cluster: Before creating a cluster, we strongly recommend that you validate your configuration. Validation helps you confirm that the configuration of your servers, network and storage meets a set of specific requirements for failover clusters.

Via PowerShell: Open an administrative PowerShell session by right-clicking the Start button and then selecting Windows PowerShell (Admin).
– To validate the Servers “HyperV and TechWindows2022“, for Failover Clustering, run the command. Ensure to replace the nodes with yours!

Test-Cluster -Node "HyperV","TechWindows2022"

Via Server Manager, choose the Tools drop-down and select Failover Cluster Manage
– In Failover Cluster Manager, go to the middle column under Management and choose Validate Configuration.

Screenshot-2021-07-12-at-23.58.55

This window is informational. You can also choose to not show this page “Before you begin” again by check the box.

Screenshot-2021-07-12-at-23.59.21

In the Select Servers or a Cluster window, add in the names of the two machines that will be the nodes of the cluster. For example, if the names are HyperV and TechWindows2022, enter the name and select Add.
– You can also choose the Browse button to search Active Directory for the names. Once both are listed under Selected Servers, choose Next.

Screenshot-2021-07-13-at-00.00.08

As you can see below, both servers are being selected and will be added.

Below is an output window, showing the two nodes we will be validating. To proceed, click on Next as shown below.

Below is an output window, showing the two nodes we will be validating. To proceed, click on Next as shown below.

Screenshot-2021-07-13-at-00.02.46

Select the Run all test (recommended). This is the most thorough form of validation, that Microsoft expects for complete support. Click on Next to proceed.
- Note: If you select to run only tests I select, it allows you to specify a subset of available tests.

Screenshot-2021-07-13-at-00.03.07

On the Confirmation page, it will give you the listing of all the tests it will check.
– Choose Next to begin the test.

Screenshot-2021-07-13-at-00.03.34

The tests will begin and the progress will be displayed as shown below. The overall test battery can take quite some time to complete.

Screenshot-2021-07-13-at-00.03.59

Once completed, the Summary page appears after the tests run. While still on the Summary page, click View Report and read the test results. Make any necessary changes in the configuration and rerun the tests.
– If the following error is prompted, please refer to the following guide: Connectivity to a writable domain controller from node could not be determined because of an error: The distinguished name of the node could not be determined.
– Click on Finish.

Screenshot-2021-07-16-at-13.10.58

To view the results of the tests after you close the wizard, see SystemRoot\Cluster\Reports\Validation Report date and time.html.

Screenshot-2021-07-19-at-19.22.25

Part 3 – Create Hyper-V Cluster via the Failover Cluster Manager: Open Server Manager and select Failover Clustering from Tools Menu and Select tools and then click on Failover Cluster Manager. Ensure the following prerequisites are met before creating a Failover Cluster.
– All nodes must have at least one IP address and must be in the same subnet.
– The Failover Clustering role must be installed on all servers. In my case, they are HyperV and TechWindows2022.
– Management operating system on all nodes must be the same version and properly patched.
– The nodes “HyperV and TechWindows2022” must be in the same domain and organizational unit.
– Your user account must have the correct privileges to create a computer account in the organizational unit where the nodes reside or the computer account must be pre-staged in that location. If this prerequisite is not met, you may have the following error: Failover Cluster Manager failed while managing one or more clusters, the error was unable to determine if the computer exists in the domain.

Via PowerShell: Open an administrative PowerShell session by right-clicking the Start button and then selecting Windows PowerShell (Admin).
– Run the following command to create the cluster if you are using static IP Addresses. For example, the machine names are HyperV and TechWindows2022, the name of the cluster will be TechDACluster, and the IP Address will be 192.168.xxx.124.

New-Cluster -Name TechDACluster -Node "HyperV","TechWindows2022" -StaticAddress 192.168.xxx.124

If you are using a DHCP, run the following command below to create the cluster. For example, the machine names are HyperV and TechWindows2022, and the name of the cluster will be TechDACluster.

New-Cluster -Name TechDACluster -Node "HyperV","TechWindows2022"

Via the Server Manager: From Server Manager, choose the Tools drop-down and select Failover Cluster Manager.

Screenshot-2021-07-12-at-21.54.28
When Failover Cluster Manager opens, it should automatically bring in the name of the cluster you created. If it does not, go to the middle column under Management and choose Connect to Cluster. Input the name of the cluster you created and OK.

Select “Create Cluster” under the action menu to create the Failover Cluster.

Screenshot-2021-07-12-at-21.54.04

The window below is just informational. You can also choose to not show this page “Before you begin” again by check the box.

Screenshot-2021-07-12-at-22.25.43

In the Select Servers, add in the names of the two machines that will be the nodes of the cluster. For example, if the names are HyperV and TechWindows2022, enter the name and select Add.
– You can also choose the Browse button to search Active Directory for the names. Once both are listed under Selected Servers, choose Next.

Screenshot-2021-07-12-at-22.26.07

As you can see below, the first node (HyperV) server is selected and will be added very shortly.

If you already know the server FQDN or server name only, enter the name in the field and click on Add as shown below.
– As you can see, this is very straightforward provided you have the needed rights in AD to add the Computer Object.

Screenshot-2021-07-13-at-00.36.06

As you can see below,  the Hyper-V servers (hosts) have been successfully added. Click on Next to continue.

Screenshot-2021-07-13-at-00.36.31

Note: On the next page, you will be required to create an administrative computer name and IP address. This Computer Object and its IP address are not as vital for a Hyper-V cluster as they are for other cluster types because the VMs (virtual machines) will not be accessed via the cluster. However, they are still required.

Type a Cluster Name, IP Address for the cluster. If you are using a pre-staged account, ensure that you use identical spelling.  The matching object that is created in Active Directory is known as the cluster’s Computer Name Object (CNO).
– When you are done, click on continue to proceed.

Screenshot-2021-07-13-at-01.13.41

You can select the checkbox to add all eligible storage to the cluster as part of the process and then click on Next

Screenshot-2021-07-13-at-01.38.35-1

The next window as shown below displays a progress bar as your cluster is built. It will automatically advance to the Summary page once it is done. There will be a View Report button that opens a simple web page with a list of all the steps that were taken during cluster creation. This can help you to troubleshoot any errors that occur. As with the validation wizard, the report is saved in C:\Windows\Cluster\Reports on all nodes.

Screenshot-2021-07-13-at-01.40.38-1

As you can see below, we have the option to View Report to check details of the cluster creation process.
– Click on the Finish button to complete the Cluster setup.

Screenshot-2021-07-13-at-01.48.12-1

As you can see on the Server Manager for both of our nodes, they have been successfully configured servers for High Availability.

Open the Failover cluster and Select the Nodes Option to View the nodes available with the cluster

If you ever wish to shut down the Cluster. This option can be found under the action Tab or More Actions menu. This will completely stop the cluster. The interface itself is simple and a Yes/No dialog window will be prompted.
– You can also Destroy a Cluster. This option completely removes the cluster object from AD and deletes the cluster’s configuration from the nodes. Before proceeding with this option, ensure all roles are removed. Similar to the Shut Down Cluster command, there is only a single, simple dialog. Below are the steps to Shut Down or Destroy a Cluster.

Screenshot-2021-07-19-at-20.29.40

Part 4 – Configure Cluster Quorum: Windows Server Failover Clustering provides high availability for workloads. These resources are considered highly available if the nodes that host resources are up; however, the cluster generally requires more than half the nodes to be running, which is known as having a quorum. Quorum is designed to prevent split-brain scenarios which can happen when there is a partition in the network and subsets of nodes cannot communicate with each other or there is a problem with communication between subsets of cluster nodes so that multiple servers don’t try to simultaneously host a resource group and write to the same disk at the same time which can lead to numerous problems. However, this is prevented with Failover Clustering’s concept of quorum which forces only one of these groups of nodes to continue running, so only one of these groups will stay online.
– Quorum determines the number of failures that the cluster can sustain while still remaining online.
– By having this concept of quorum, the cluster will force the cluster service to stop in one of the subsets of nodes to ensure that there is only one true owner of a particular resource group. Once nodes that have been stopped can again communicate with the main group of nodes, they will automatically rejoin the cluster and start their cluster service.

Failover Clustering supports three types of Quorum Witnesses:
- Cloud Witness: Blob storage in Azure accessible by all nodes of the cluster. It maintains clustering information in a witness.log file, but doesn't store a copy of the cluster database.
- File Share Witness: A SMB file share that is configured on a file server running Windows Server. It maintains clustering information in a witness.log file, but doesn't store a copy of the cluster database.
- Disk Witness: A small clustered disk which is in the Cluster Available Storage group. This disk is highly-available and can failover between nodes. It contains a copy of the cluster database. A Disk Witness isn't supported with Storage Spaces Direct.

For a two-node failover cluster, the storage should contain at least two separate volumes (LUNs) if using a witness disk for quorum. The witness disk is a disk in the cluster storage that is designated to hold a copy of the cluster configuration database. For this two-node cluster example, the quorum configuration will be Node and Disk Majority. Node and Disk Majority means that the nodes and the witness disk each contain copies of the cluster configuration, and the cluster has quorum as long as a majority (two out of three) of these copies are available. 

Note: You will be requiring a shared disk that will be accessible across all Hyper-V Server to configure as Quorum Witness
– Right Click on the Cluster
– Select More Actions and
– Click on Configure Cluster Quorum Setting as shown below.

The window below is just informational. You can also choose to not show this page “Before you begin” again by check the box.

Screenshot-2021-07-13-at-03.37.32

On the Select Quorum Configuration window, we have got three options. I will be selecting the first one as shown below.
Follow through with the next steps to complete the Cluster Quorum setup.

Screenshot-2021-07-13-at-03.40.24

Part 5 – Configure Clustered Shared Volume (CSV Disk): CSV (Cluster Shared Volumes) is a feature in Windows Server in which shared disks are concurrently accessible to all nodes within a failover cluster. You need to tell the cluster manager which storage should be used for the CSVs. Here we will be using the CSVs to hold disks for fault-tolerant VMs.

In order to complete these steps, the CSV disk should be accessible to all the nodes (HyperV and TechWindows2022) and should be a valid disk in the Disk Management snap-in window.
– To enable a CSV on a disk, open the Failover Cluster and expand the Storage node and select the Disks node, select the cluster disk that you want to use as a CSV, and click the Add to Cluster Shared Volumes link in the Actions pane. This will create a mount point for the CSV in the system drive.

Screenshot-2021-07-13-at-03.48.01

Follow through with the next steps to complete the Clustered Shared Volume (CSV Disk) configuration. In the future, you may need to need to extend a volume, kindly refer to these guides on how to do this: Initialize and format a virtual disk: How to add and remove a new virtual disk from a VM on VMware Workstation, how to extend a VM’s Hard Disk on VMware Workstation, and how to install and configure iSCSI Target Server and iSCSI Initiator on a Windows Server.

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x