Export (0) Print
Expand All
13 out of 13 rated this helpful - Rate this topic

Step 5: Respond to an Unplanned Failover

Published: May 31, 2012

Updated: May 31, 2012

Applies To: Windows Server 2012, Windows Server 2012 R2



This document includes steps to follow to get your virtual machines back online after an unplanned failover has occurred. In an unplanned failover, the primary server has failed unexpectedly, perhaps as a result of a major hardware failure or natural disaster. There is the possibility of data loss, since there was no opportunity to transmit changes on the primary virtual machines that might not have been replicated yet.

In contrast to failover clustering, the workload does not automatically transfer to the virtual machines on the Replica server if the primary server goes offline.

noteNote
This topic includes sample Windows PowerShell cmdlets that you can use to automate some of the procedures described. For more information, see Using Cmdlets.

Do this step using Windows PowerShell

  1. Open Hyper-V Manager and connect to the Replica server.

  2. Right-click the name of the virtual machine you want to use, point to Replication, and then point to Failover….

  3. In the dialog that opens, choose the recovery snapshot you want the virtual machine to recover to, and then click Failover….. The Replication Status will change to Failed over – Waiting completion and the virtual machine will start using the network parameters you previously configured for it (see 2.3 Enable replication for virtual machines). If you have not previously configured the network parameters or if you want to use different parameters at this point, you can use the Windows PowerShell cmdlet below to do this.

  4. Use the Complete-VMFailover Windows PowerShell cmdlet below to complete failover.

  5. Repeat these steps for each virtual machine you want to bring back online.

PowerShell Logo 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 sample script will complete an unplanned failover:

$Primary = "host1"
$Replica = "host2"
$VMName = "vm01"

Start-VMFailover -VMName $VMName -ComputerName $Replica

Complete-VMFailover -VMName $VMName -ComputerName $Replica

Start-VM -VMName $VMName -ComputerName $Replica

#
# Assuming that Primary server is recovered.
#

Set-VMReplication -VMName $VMName -AsReplica -ComputerName $Primary

Set-VMReplication -VMName $VMName -Reverse -ReplicaServerName $Primary -ComputerName $Replica

Start-VMInitialReplication -VMName $VMName -ComputerName $Replica

To provide new or different network parameters for the Replica virtual machine to use when it comes online, use the following example cmdlet, substituting appropriate values:

$NetworkAdapter = Get-VMNetworkAdapter -VMName $Replica -Name $VMNetworkAdapterName 
$NetworkAdapter | Set-VMNetworkAdapterFailoverConfiguration -IPV4Address 172.20.31.100 -IPV4SubnetMask 255.255.255.0 -IPV4DefaultGateway 172.20.31.1 -IPV4PreferredDNSServer 172.20.31.101 -IPV4AlternateDNSServer 172.20.31.102

Once the Replica virtual machine(s) are back online running on the Replica server, they are unprotected against further failure. You can provide this protection by enabling reverse replication back to the primary server once the server comes back online.

noteNote
The Replica virtual machines must be replicated back to their original primary server. Do not attempt to configure replication from the Replica server to a third server.

Do this step using Windows PowerShell

  1. Open Hyper-V Manager and connect to the Replica server.

  2. Right-click the name of the virtual machine you want to reverse replicate, point to Replication, and then point to Reverse replication…. The Reverse Replication wizard opens.

  3. Complete the Reverse Replication wizard. You will find the requested information to be very similar if not identical to the information you provided in the Enable Replication wizard (see 2.3 Enable replication for virtual machines.

PowerShell Logo 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.

To reverse replication of the virtual machine, use the following example cmdlet:

Set-VMReplication -reverse -VMName $ReplicaVM2

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.