Skip to content

Failover Clustering

Hyper-V failover clustering provides high availability for virtual machines by enabling automatic failover between cluster nodes. This section guides you through configuring a failover cluster for Hyper-V environments.


Prerequisites and Planning

Before configuring a failover cluster, ensure:
- Hardware: Nodes must meet Windows Server hardware requirements. Use shared storage (SAN, NAS, or Storage Spaces Direct).
- Network: Dedicated heartbeat network (isolated from production traffic) and shared storage network.
- Software: Windows Server 2016 or later with Hyper-V and Failover Clustering roles installed.
- Quorum: Configure quorum settings (majority-node, disk witness, or file share witness) based on cluster size.


Installing Failover Clustering

  1. Install the feature:

    Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
    
    Verify installation with:
    Get-WindowsFeature -Name Failover-Clustering
    

  2. Validate cluster configuration:
    Use the Failover Cluster Manager GUI or PowerShell:

    Test-Cluster -Node <Node1>,<Node2>
    
    Address any warnings (e.g., network connectivity, firewall rules).


Creating the Cluster

  1. Open Failover Cluster Manager and select "Create a cluster".
  2. Add nodes: Enter the names of cluster nodes.
  3. Validate and create:
  4. Confirm network and storage settings.
  5. Complete the wizard to form the cluster.

PowerShell alternative:

New-Cluster -Name "MyCluster" -Node <Node1>,<Node2> -StaticAddress <IP>


Configuring Shared Storage

  1. Add storage:
  2. For Storage Spaces Direct: Format disks as a single storage pool.
  3. For SAN/NAS: Ensure LUNs are accessible to all nodes and formatted with NTFS.
  4. Create cluster disk:
  5. Right-click the cluster in Failover Cluster Manager > "Storage" > "Add Storage".
  6. Format the disk and assign it to the cluster.

Adding Virtual Machines to the Cluster

  1. Prepare VMs:
  2. Ensure VMs are configured with static IP addresses and proper network settings.
  3. Disable "Use Hyper-V Failover Clustering" in VM settings (if applicable).
  4. Add VMs to the cluster:
  5. In Failover Cluster Manager, navigate to "Virtual Machines" > "Add Virtual Machine".
  6. Select the VM’s VHD file and assign it to the cluster.

PowerShell example:

Add-ClusterVMMonitor -Cluster "MyCluster" -VMName "VM01"


Configuring VM Failover Settings

  1. Set VM availability:
  2. Right-click the VM in the cluster > "Properties" > Set "Failover" to "Enabled".
  3. Define failover policies:
  4. Adjust priority for nodes (e.g., designate a primary node for critical VMs).
  5. Configure "Failover Threshold" and "Failover Delay" in the VM’s properties.

Testing and Monitoring

  1. Test failover:
  2. Manually trigger a failover via "Move Virtual Machine" in Failover Cluster Manager.
  3. Verify VM availability on the secondary node.
  4. Monitor health:
  5. Use "Cluster Health" in Failover Cluster Manager or:
    Get-ClusterResource | Where-Object { $_.State -eq "Offline" }
    
  6. Check event logs for cluster-related alerts.

Troubleshooting Common Issues

  • Network connectivity: Ensure all nodes can communicate over the heartbeat and storage networks.
  • Storage access: Verify LUNs are online and accessible to all nodes.
  • Quorum errors: Adjust quorum settings if nodes lose majority (e.g., add a disk witness).
  • Permissions: Ensure the cluster service account has access to shared storage.

Key takeaways

  • Prerequisites: Shared storage, dedicated networks, and compatible hardware are critical.
  • Cluster creation: Use PowerShell or the GUI to form the cluster and validate settings.
  • VM integration: Add VMs to the cluster and configure failover policies for reliability.
  • Testing: Regularly test failover scenarios and monitor cluster health for proactive issues.
  • Troubleshooting: Focus on network, storage, and quorum configuration for common failures.