Now to the more exciting stuff! Hyper-V Replication enables virtual machines workloads on Windows Server 2012 to be consistently copied to a remote server in the event a site or hardware system should crash.

Tasks in this Lab Module

1) Enable Hyper-V Replication.

2) Configuring Hyper-V Replication.

3) Implement a planned failover.

4) Implement an unplanned failover.

5) Remove Replication (Optional)

 

You will need a virtual machine named WS2012VMServer3 that is joined to the domain as Server3 for this exercise.

 

1) Enable replication on WS2012VMHost1 and WS2012VMHost2

  1. Log on to one of the Hyper-V hosts as your Domain\Administrator account using the password Passw0rd!
  2. On the Taskbar, click Windows PowerShell.

To enable replication on host machines, type the following commands and press ENTER after each.

 

If the script below fails to run, type Set-ExecutionPolicy RemoteSigned and then re-run the script.

 

Invoke-Command -ComputerName WS2012VMHost1 -ScriptBlock {

Set-VMReplicationServer -ReplicationEnabled $True -ComputerName WS2012VMHost1 -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $True -DefaultStorageLocation C:\Replica

Enable-NetFirewallRule -Name VIRT-HVRHTTPL-IN-TCP-NOSCOPE

}

 

Invoke-Command -ComputerName WS2012VMHost2 -ScriptBlock {

Set-VMReplicationServer -ReplicationEnabled $True -ComputerName WS2012VMHost2 -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $True -DefaultStorageLocation C:\Replica

Enable-NetFirewallRule -Name VIRT-HVRHTTPL-IN-TCP-NOSCOPE

}

 

  1. In Server Manager, click Tools, and then click Hyper-V Manager.
  2. In the Actions pan, click Connect to Server, type WS2012VMHost1, and then click OK.
  3. Click Hyper-V Manager.
  4. Click Connect to Server, type WS2012VMHost2, and then click OK.
  5. Click WS2012VMHost1, click WS2012VMServer3, and then click Start.
  6. Wait for the VM to fully start.

2) Configure Hyper-V Replication.

  1. Switch to Windows PowerShell.
  2. Type Resolve-DNSName Server3, and then press ENTER. Note the IP address.
  3. Switch to Hyper-V Manager.
  4. Click WS2012VMhost1, and then click WS2012VMServer3.
  5. Select WS2012VmServer3, and then in Actions, click Enable Replication.
  6. In the Enable Replication for WS2012VMServer3 dialog box, click Next.
  7. In Replica Server, type WS2012VMHost2, and then click Next.
  8. Accept all defaults in the remaining screens, and then click Finish.
  9. Click Close.
  10. In Hyper-V Manager, click WS2012VMHost2.
  11. Click WS2012VMServer3.
  12. In the Actions plane, click Settings.
  13. Expand Network Adapter, and then click Failover TCP/IP.
  14. Under IPv4 TCP/IP settings, check Use the following IP Address scheme for the virtual machine.
  15. Enter the following values, and then click OK.

IPv4 Address: 192.168.10.31  (Assuming this is your IP Scheme for the secondary site)

Subnet Mask: 255.255.255.0

Preferred DNS: 192.168.10.1

 

3) Implement a Planned Failover

  1. In Hyper-V Manager, click WS2012VMhost1.
  2. Click WS2012VMServer3, and then in the Actions pane, click Shut Down.
  3. Click Shut Down. Wait for the VM to power off.
  4. Click WS2012VMServer3, in the Actions pane click Replication, and then click Planned Failover.
  5. Click Failover.
  6. When fail over completes, click Close.

 

4) Implement an Unplanned Failover

  1. In Hyper-V Manager, click WS2012VMHost2.

Note: WS2012VMServer3 was started automatically after failover.

  1. Click WS2012VMServer3, and then click Turn Off.
  1. In Hyper-V Manager, click WS2012VMhost1, and then click WS2012VMServer3.
  2. In the Actions pane, click Replication, and then click Planned Failover.
  3. Click Failover.
  4. Click Close.
  1. Wait for the replica VM to start.
  2. Open Windows PowerShell.
  1. Type Resolve-DNSName Server3, and then press ENTER. Note the IP address.

 

Optional! Remove Replication if so desired.

  1. Click WS2012VMServer3.
  1. In the Actions pane, click Replication, and then click Remove Replication.
  1. Click Remove Replication.
  2. Click WS2012VMHost2.
  3. Click WS2012VMServer3.
  1. In the Actions pane, click Delete.

More Information

Tommy’s Blog

http://virtuallycloud9.com

Windows Server Blogs

http://blogs.technet.com/b/windowsserver/

Windows Server 2012 Product Download

http://aka.ms/ws2012tp

Microsoft Virtual Academy

http://aka.ms/tpva

Windows Server 2012 Virtual Labs

http://technet.microsoft.com/en-us/windowsserver/hh968267.aspx

Windows Azure 90-Day Free Trial Page

http://aka.ms/mshosting