Freigeben über


Server 2012 R2 - Lab Guide - Part 5 - Step by Step - Enabling Hyper-V Replica

Now to the more exciting stuff! Hyper-V Replication enables virtual machines workloads on Windows Server 2012 to be consistently synchronized 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)

 

This lab assumes that a second Hyper-V host named Hyperv02 has been built and joined to the domain before beginning. You will also need to create a new virtual machine named Server3 that is joined to the domain for this exercise.

 

This lab also assumes that you have completed these prior labs:

Server 2012 R2 – Lab Guide – Part 1 – Step by Step – Including Dual Boot Instructions

Server 2012 R2 – Lab Guide – Part 2 – Step by Step – Storage

Server 2012 R2 – Lab Guide – Part 3 – Step by Step – Continuously Available File Server

Server 2012 R2 - Lab Guide - Part 4 - Step by Step - Hyper-V over SMB

 

Enabling Replication on Hyperv01 and Hyperv02

  1. Log on to one of the Hyper-V hosts as your corp\administrator account using the password p@ssw0rd
  2. On the Start Screen, right click Windows PowerShell and choose to Run as Administrator

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  Hyperv01  -ScriptBlock  { Set-VMReplicationServer  -ReplicationEnabled  $True  –ComputerName  Hyperv01  -AllowedAuthenticationType Kerberos   -ReplicationAllowedFromAnyServer   $True –DefaultStorageLocation   C:\Replica;   Enable-NetFirewallRule -Name VIRT-HVRHTTPL-IN-TCP-NOSCOPE }

Invoke-Command  -ComputerName Hyperv02  –ScriptBlock  {Set-VMReplicationServer  –ReplicationEnabled   $True  -ComputerName  Hyperv02  –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 Hyperv02, and then click OK.
  3. Click Hyperv01, in the middle pane click Server3, and then click Start.
  4. Wait for the VM to fully start.

 

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 Hyperv01, and then click Server3.
  5. Select Server3, and then in Actions, click Enable Replication.
  6. In the Enable Replication for Server3 dialog box, click Next.
  7. In Replica Server, type Hyper02, 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 Hyperv02.
  11. Click Server3.
  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 (Let’s just assume that this is your IP Scheme for the secondary site)

Subnet Mask: 255.255.255.0

Preferred DNS: 192.168.10.1

 

Implementing a Planned Failover

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

 

Implementing an Unplanned Failover

  1. In Hyper-V Manager, click Hyperv02.

Note: Server3 was started automatically after the previous failover.

  1. Click Server3, and then click Turn Off.
  1. In Hyper-V Manager, click Hyperv01, and then click Server3.
  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! Removing Replication if so desired.

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

 

Congrats!  You have finished Lab Guide Part 5!

 

Follow Up Guides: coming soon:

Lab Guide 6 – Windows 2012 R2 – Shared Nothing Live Migration

 

More Information

Tommy’s Blog

https://www.virtuallycloud9.com

Windows Server Blogs

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

Windows Server 2012 Product Download

https://aka.ms/ws2012tp

Microsoft Virtual Academy

https://aka.ms/tpva

Windows Server 2012 Virtual Labs

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

Windows Azure 30-Day Free Trial Page

https://aka.ms/mshosting