Configuring Hyper-V Replica in Windows Server 2012 R2

Hyper-V Replica is a new feature added to the Hyper-V Role in Windows Server 2012 Standard / Data Center and Hyper-V Server 2012. It uses an asynchronous data replication technology for organizations to implement an affordable Business Continuity and Disaster Recovery (BCDR) solution for virtualized workloads. This allows virtual machines running at a Primary Site to be efficiently replicated to Secondary Site (Replica Site) across a LAN/WAN link without relying on software or hardware technologies outside of the Windows Server 2012 Operating system. In Windows Server 2012 R2, Microsoft has enhanced Hyper-V Replica features like Extended Replication and configurable Hyper-V Replica frequency options. In Windows Server 2012 R2 Hyper-V, we can configure VM to replicate from Primary Site A to Secondary (Replica) Site B and then further replicate from Secondary Site B to Extended Replica Site C as shown in the figure. In Windows Server 2012 (not R2), Hyper-V Replica provided a fixed replication interval of 5 minutes. In Windows Server 2012 R2 it has been enhanced and as such we can configure the replication interval from the old default of 5 minutes to every 30 seconds, 5 minutes or 15 minutes as per the environment, criticality of operations and the available bandwidth.

Management of Adding Hyper-V Host in Hyper-V Manager

1. On KTM-HOST1, In the Hyper-V Manager console, Right-Click on Hyper-V Manager, select Connect to Server…

2. On Select Computer dialog box, select Another computer and type KTM-HOST2 and click OK, where KTM-HOST2 is Hyper-V Server. Do the same process to Hyper-V Server, KTM-HOST3.

Configuring a Standalone Hyper-V Replica Servers

1. In the Hyper-V Manager interface, Right Click on KTM-HOST1, select Hyper-V Settings…

2. In the Hyper-V Settings for KTM-HOST1 dialog box, Click on Replication Configuration. In the Replication Pane, select Enable this computer as a Replica server. In the Authentication and ports section, select Use Kerberos (HTTP).

3. In the Authorization and storage section, select Allow replication from the specified servers and Click Add.

4. On the Add Authorization Entry dialog box, in the Specify the primary server: *.msservpro.com and then click Browse and select D:\Hyper-V Replica\ folder. In the Specify the trust group: type KIRTIPUR Replica Group and click OK.

5. On the Hyper-V Settings for KTM-HOST1 dialog box, click Apply and then click OK.

6. In the Settings Window, read the message and click OK and click OK.

7. Do the same process on KTM-HOST2 and KTM-HOST3. On KTM-HOST2, In the Add Authorization Entry dialog box, in the Specify the primary server; KTM-HOST1.msserverpro.com and then click Browse and select C:\Hyper-V Replica\ folder. In the Specify the trust group must be same as previous. On KTM-HOST3, In the Add Authorization Entry dialog box, Specify the primary server; KTM-HOST2.msserverpro.com and then click Browse and select D:\Hyper-V Replica\folder. In the Specify the trust group must be same as previous.

Enabling the Windows Firewall Rule to Enable Replication between the Primary, Replica and Extended Replica Server

1. On KTM-HOST1, Open Windows Firewall with Advance Security, Open Run box, and type wf.msc and click OK.

2. On Windows Firewall with Advanced Security page, click on Inbound Rules under Windows Firewall with Advanced Security on Local Computer.

3. In Inbound Rules, Right-Click on Hyper-V Replica HTTP Listener (TCP-In) and click Enable Rule. Do the same process on KTM-HOST2 and KTM-HOST3. If Certificate based authentication is used, we should Enable Rule Hyper-V Replica HTTPS Listener (TCP-In).

Enable Replication for a virtual machine on KTM-HOST1

1. On KTM-HOST1, Open the Hyper-V Manage console, in the Details pane, Right-Click the selected virtual machine, KTM-SQL-DB1, and choose Enable Replication.. This starts the Enable Replication wizard.

2. On the Before You Begin page, click Next.

3. On the Specify Replica Server page, in the Replica Server box, enter either the NetBIOS or the Fully-Qualified Domain Name (FQDN) for the Replica server, KTM-HOST2 and click Next.

9. On the Completing the Enable Replication wizard page, review the information in the summary and then click Finish.

10. The Enabling Replication process will start and should complete successfully (i.e. a virtual machine is created on the Replica Server and delta replication commences).After Finish the Replica between Primary HOST, KTM-HOST1and Secondary Host, KTM-HOST2 and then start for Extended Replication from KTM-HOST2.

To verify the consistency of replication across the sites, test Failover feature is available which initiates on demand by the Hyper-V Administrator. It creates a temporary virtual machine which is a replica of the original and checks its consistency and usability without interrupting the production workload running on the Primary Site. During testing of failover, there is no need to shut down the VM in production site and also the temporary machine created is stopped on its own without further intervention, along with the option to delete the test remnants. The purpose of this test failover is to check the VM’s replication status in Replica and Extended Replica Site. The network configuration for the Test Failover virtual machine is disconnected by default so as not to interfere with the production workload as noted above.

1. Log on to Primary Site, KTM-HOST1, Open Hyper-V Manager console and Connect… KTM-SQL-DB1 and then Create the Test document named Hyper-v Test Failover on the desktop and type This is test of Hyper-V Test Failover and saved it.

7. After verify this, In the details pane, select the virtual machine begin tested. Right-click on the virtual machine, KTM-SQL-DB1, select Replication and then choose Stop Test Failover to Stop the Test Failover.

8. On the Stop Test Failover dialog box, Click Stop Test Failover and then it automatically removed from Hyper-V Manager as the test is completed.We can do the same process on Extended Replica server, KTM-HOST3.

Planned Failover and Failback:

Planned Failover initiates a failover of a virtual machine from a Primary Site to Replica Site. When planned failover is executed, replication option at the primary site virtual machine must be turned off. Once the Replica Site virtual machine is operational, the direction of the replication should be reversed so as to send the traffic from Replica Site (which is now our primary site) to the original primary site which has been turned off now for the purpose of planned failover. For Planned test Failover, if the Reverse replication direction after failover is ticked, we must disabled Extended replication on Replica Virtual Machine or Remove Extended replication on Replica virtual machine. However, if the Reverse replication direction after failover is not ticked, the process will run without errors but it will not be possible to failback to primary. So, test must be carefully planned. Please follow the steps given below carefully.

1. To perform a planned failover, first we must Shut down the Primary VM (KTM-SQL-DB1) from Primary Server, KTM-HOST1.

2. On KTM-HOST1, In the Hyper-V Manager, In the details pane, select the virtual machine and Right Click on KTM-SQL-DB1, select Replication and then Choose Planned Failover..

3. On Planned Failover dialog box, make sure select Reverse the replication direction after failover and Start the Replica virtual machine after failover and Click on Fail Over.

4. On Planned Failover dialog box, we get error message “The virtual machine is not prepared for planned failover”. Click Close and Click Cancel.

5. In Hyper-V Manager console, Click KTM-HOST2 and Right-Click on KTM-SQL-DB1, select Replication and then Choose to Remove Replication.

16. In Hyper-V Manager interface, click KTM-HOST1 and make sure VM (KTM-SQL-DB1) is Running State and then check View Replication Health..

17. In Hyper-V Manager interface, Click KTM-HOST2 and make sure VM (KTM-SQL-DB1) is Off State and then check View Replication Health..

Unplanned Failover:

Unplanned Failover initiates a failover when the Primary Site virtual machine fails unexpectedly and cannot be brought back online. An unplanned failover is initiated at the replica site. (It is the test closest to the real case scenario).

1. To perform an unplanned failover, the Primary Site must be offline state. Here, we will shut down the Primary Site Hyper-V Server, KTM-HOST1.

3. On the Failover dialog box, choose the recovery point to use and then Click Failover. The virtual machine is then started on the Replica Server.

4. After the Replica virtual machine is started, the replication between Primary and Secondary is broken and replication problems.

Summary:

Hyper-V Replica is a host-based virtual machine asynchronous replication solution from Microsoft without extra licensing cost. In Windows Server 2012 R2 Hyper-V, Microsoft has enhanced Extended Replication features and configurable Hyper-V Replica frequency options. Microsoft has provided a highly dependable, immediately restorable and alternatively highly configurable disaster recovery solution for the high availability production systems for businesses of all size. Hope this article will get you started with the usage and benefits of Hyper-V replication and disaster recovery solution.

Hi Jan Bjelland,
Yes,you can use in workgroup environment using self-signed SSL certificate. You can do from Hyper-V 2012. For this I will highly recommend to look the “Hyper-V Replica Essentials” -Vangel Krstevski October 2013.