rolffimages - Fotolia
Manually initiate the Hyper-V replication failover process
Hyper-V replication failover only requires two steps. But before you initiate failover, perform some tests to ensure the recovery point has consistent data.
To ensure Hyper-V replication failover will go according to plan, admins need to not only select a recovery point, but also run tests to make sure the desired recovery point is usable. Then they can use a simple PowerShell command to complete the failover process.
Hyper-V replication enables a disaster recovery (DR) scenario for VMs running on Hyper-V. As part of Hyper-V replication, you need to deploy a primary Hyper-V server at the production site and a Hyper-V Replica or a secondary server at the DR site.
If disaster strikes the Hyper-V primary server, the virtualized workloads are replicated to the Hyper-V secondary server, and are brought online to provide business continuity. This is sometimes referred to as an unplanned failover. With an unplanned failover, you are required to complete the Hyper-V replication failover process before you can bring the VM online.
Step 1: Select a recovery point
If you turn on the recovery history feature in Hyper-V Replica, you need to select a recovery point and then restore the VM. You'll be provided with the list of available recovery points.
Once you failover to a recovery point, you need to perform some tests to ensure the recovery point you selected is usable and has all the required data. If you need to select a different recovery point, you can always cancel the failover by right-clicking on the VM, and then clicking on Cancel Failover.
Step 2: Do a complete failover
Once you're sure the selected recovery point is usable and contains all of the required data, you can do a complete failover. A complete failover is performed to ensure the recovery point is committed and the VM is ready for production use.
To complete the failover process, use the PowerShell command below:
Complete-VMFailover SQLVM -Confirm:$False
The above command completes the Hyper-V replication failover process for SQLVM, merges the selected recovery point with the VM and removes all the other recovery points.
To perform both steps using PowerShell, use the following commands:
$ThisRecoveryPoint = Get-VMSnapshot -VMName SQLVM -SnapshotType Replica
Start-VMFailover -Confirm:$false -VMRecoverySnapshot $ThisRecoveryPoint[0]
Complete-VMFailover -VMName SQLVM -Confirm:$false
Once you complete the Hyper-V replication failover process for a VM, all the other recovery points are deleted, and you won't be able to select a different recovery point. So only perform step 2 once you are sure the selected recovery point has consistent data.