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.
4. On the Specify Connection Parameters page, click Next.
5. On the Choose Replication VHDs page, click Next.
6. On the Configure Replication Frequency page, select 30 seconds and click Next.
7. On the Configure Additional Recover Points page, select Create additional hourly recovery points and click Next.
8. On the Choose Initial Replication Method page, 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-HOST1 and Secondary Host, KTM-HOST2 and then start for Extended Replication from KTM-HOST2.
Enabled Extended Replication from the Replica Server to Extended Replica Server (KTM-HOST2 to KTM-HOST3)
11. In the Hyper-V Manager interface, click KTM-HOST2 and Right click on Replicated virtual machine, KTM-SQL-DB1, click Replication and then select Extend Replication…
12. On the Before You Begin page, click Next.
13. On the Specify Replica Server page, type KTM-HOST3 in Replica server and click Next.
14. On the Specify Connection Parameters page, click Next.
15. On the Configure Replication Frequency page, select 5 minutes and click Next.
16. On the Configure Additional Recovery Points page, click Next.
17. On the Choose Initial Replication Method page, click Next.
18. On the Completing the Extend Replication wizard page, click Finish.
19. Extended Replicating.. Begins..
View Replication Heath of Virtual Machine, KTM-SQL-DB1
1. Replication Heath between KTM-HOST1 and KTM-HOST2.
2. Replication Health between KTM-HOST2 and KTM-HOST3.
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.
2. In Hyper-V Manager console, In the details pane, select the virtual machine on the Replica Server, KTM-HOST2, and Right-click on replica virtual machine (KTM-SQL-DB1), select Replication and choose Test Failover…
3. On Test Failover dialog box, select a recovery point, and then click Test Failover.
4. The New copy of the VM created in Hyper-V Manager in the Off State and then Right click on just created virtual machine, KTM-SQL-DB1-Test and click Connect…
5. On the KTM-SQL-DB1-Test on KTM-HOST2 – Virtual Machine Connection, click Start button.
6. Verify that Hyper-V Test Failover document on the desktop.
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.
6. On the Remove Replication dialog box, select Remove extended replication and then Choose to Remove Replication.
7. Repeat the process from Step 1 to 3 .Then Planned Failover process begins. After few minutes Planned Failover completed successfully dialog box, click Close.
8. In Hyper-V Manager interface, Click KTM-HOST2 and make sure KTM-SQL-DB1 VM is Running.. State.
9. In Hyper-V Manager interface, click KTM-HOST1 and make sure that VM (KTM-SQL-DB1) is Off State.
10. After successfully Testing the Planned Failover VM (KTM-SQL-DB1) on KTM-HOST2, Shut Down.. virtual machine to reverse back to Primary Host KTM-HOST1.
11. On the Shut Down Machine dialog box, click Shut Down..
12. In Hyper-V Manager interface, Click KTM-HOST2, Right-Click on KTM-SQL-DB1, Click Replication and then click Planned Failover..
13. On the Planned Failover dialog box, select Reverse the replication direction after failover and Start the Replica virtual machine after failover and then click Fail Over.
14. Planned Failover begins..
15. On the Planned Failover completed successfully dialog box, click Close.
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 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.
2. Go to the Replica Server, KTM-HOST2. In Hyper-V Manager interface, Right-Click the Replica virtual machine (KTM-SQL-DB1), Click Replication and then Click Failover..
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.
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.
server virtualization, virtualization software, virtualisation, virtual machines, cheap virtual web hosting, desktop virtualization, virtual infrastructure, server consolidation, storage virtualization, virtualization management, application virtualization, disaster recovery, virtualisation services, virtual server, data center, server virtualisation, virtualization storage, virtualization server, vm ware, virtualization applications
- Creating a Windows Virtual Machine and Availability Set at the same time using the Azure Portal - June 11, 2017
- Remove a Node from a Windows Server 2016 Hyper-V Cluster and Destroy a Cluster Procedure - May 14, 2017
- Best Practices on Setting up Hyper-V Cluster Networks in Windows Server 2016 - May 10, 2017
- Implementing Failover Clustering with Windows Server 2016 Hyper-V - May 6, 2017
- Configuring iSCSI Storage and Initiator in Windows Server 2016 - April 20, 2017
- Upgrading the VM configuration version in Windows Server 2016 Hyper-V - April 5, 2017
- VM Load Balancing in Windows Server 2016 - March 31, 2017
- Cluster OS Rolling Upgrades in Windows Server 2016 - March 29, 2017
- Installing Active Directory Domain Controller on Windows Server 2016 - March 18, 2017
- Export and Import the Certificate on Microsoft Exchange Server 2016 - March 18, 2017