Step 4: Perform a Planned Failover
Published: May 31, 2012
Updated: May 31, 2012
Applies To: Windows Server 2012
This topic includes the steps to perform a planned failover. A planned failover is an operation in which you move operations on any primary virtual machine to its corresponding Replica virtual machine. For example, you might perform a planned failover in order to perform maintenance or upgrades on a primary virtual machine or when you have advance notice of an impending event that might require taking the primary server offline. You might also perform a planned failover to demonstrate and confirm readiness for a disaster recovery scenario.
In a planned failover, any un-replicated changes are first copied over to the Replica virtual machine, so no loss of data occurs. After the planned failover, the Replica virtual machine takes over the workload; to provide similar protection for the virtual machine that is now servicing the workload, you configure “reverse replication” to send changes back to the primary virtual machine (once that comes back online).
|This topic includes sample Windows PowerShell cmdlets that you can use to automate some of the procedures described. For more information, see Using Cmdlets.|
If you have not already done so, follow the procedure in 2.4 Configure primary server to receive replication (optional) to configure the primary server to receive replicated data. You might have already used the procedure to configure the Replica server, but for a planned failover, the primary server must also be enabled for replication, so you might have to repeat the step for the primary server.
Start Hyper-V Manager on the primary server and choose a virtual machine to fail over. Turn off the virtual machine that you want to fail over.
Right-click the virtual machine, point to Replication, and then point to Planned Failover.
Click Fail Over to actually transfer operations to the virtual machine on the Replica server. Failover will not occur if the prerequisites have not been met.
|If you delete a snapshot on the Replica server after failover has begun, you commit to the operation and cannot cancel the failover.|
Windows PowerShell equivalent commands
The following Windows PowerShell cmdlet or cmdlets perform the same function as the preceding procedure. Enter each cmdlet on a single line, even though they may appear word-wrapped across several lines here because of formatting constraints.
This sequence of cmdlets will conduct a planned failover of the virtual machine “CRMVM,” provided you have already configured the primary server (in addition to the Replica server) to accept replication traffic using the procedure in Step 2. Run these cmdlets on the primary server:
Stop-VM $PrimaryVM1 Start-VMFailover -VMName $PrimaryVM1 –prepare
Then run these cmdlets on the Replica server:
$ReplicaVM1 = “CRMVM” Start-VMFailover -VMName $ReplicaVM1 Set-VMReplication -reverse -VMName $ReplicaVM1 Start-VM $ReplicaVM1