Sunday, July 1, 2012

Configuring Hyper-V replica on standalone Hyper-V servers in the same Active Directory domain

On Windows Server 2012, one of the new features of Hyper-V is Hyper-V replica. Using Hyper-V replica, administrators can replicate virtual machines from one Hyper-V host to another Hyper-V host. The virtual machines are replicated over IP networks asynchronously.

Goals
Configuring and testing Hyper-V replica on standalone Hyper-V servers in domain environment.

Lab environment
  • 1 domain controller named DC01 under test.contoso.com
  • 2 Hyper-V servers named HVSVR01 and  HVSVR02. HVSVR01 is the Primary Server. HVSVR02 is the Replica Server joined the test.contoso.com
  • 1 VM named fs01.test.contoso.com.  fs01.test.contoso.com  is deployed in HVSVR01
  • The IP address of  fs01.test.contoso.com is "10.5.0.2"
  • All servers are under 10.0.0.0/8 network for testing
Configure Replication Configuration
1. On HVSVR01, log in as Domain Administrator.
2. Launch "Hyper-V Manager".
3. On the menu, click "Actions > Hyper-V Settings".
4. On left pane, select "Replication Configuration".


5. On right pane, check "Enable this computer as a replica server".
6. Under "Authentication and ports", check "Use Kerberos (HTTP)" and leave the "Specifc the port" to "80".

Remark: If Kerberos authentication setting is used, the data transmitted from the primary to the replica server is not encrypted.

Remark: Hyper-V replica supports replicate to other Hyper-V servers which is outside of Active Directory. To replicate to these Hyper-V servers, you can select "Use certificate-based Authentication (HTTPS)" for authentication.

7. Next to "Authorization and storage", select "Allow replication from the specified servers".
8. Click "Add".
9. Under "Specify the primary server", type "HVSVR02.test.contoso.com".

Remark: To configure the replica server to receive VMs from different server, you can enter wildcard character for the name (*.test.contoso.com).

10. Under "Specify the default location to store replica files", type "D:\".
11. Under "Specify the trust group", type "HV Group".


12. Click "OK".


13. Click "OK".

Remark: If you don't configure the "Replication Configuration" on the Primary Server, after failover, the role of the original primary server cannot receive the replication from the replica server.

14. Repeat steps 2 - 7 on HVSVR02.
15. Click "Add".
16. Under "Specify the primary server", type "HVSVR01.test.contoso.com".
17. Under "Specify the default location to store replica files", type "D:\HVSVR01".
18. Under "Specify the trust group", type "HV Group".
19. Click "OK".


20. Click "OK".
21. On HVSVR02, launch "Windows Explorer", navigate to "D:\".


The folders have been created automatically.

22. On HVSVR01, launch "Windows Firewall with Advanced Security".
23. Right-click "Inbound Rules", select "New Rule".


24. Select "Predefined > Hyper-V Replica HTTP".


25. Click "Next".
26. On "Perdefined Rules" windows, check "Hyper-V Replica HTTP Listener (TCP-In)".


27. Click "Next".
28. On "Action" windows, select "Allow the connection", click "Finish".


29. Repeat steps 22 - 28 on HVSVR02.

Enabling replication on the virtual machine
29. On Hyper-V Manager of HVSVR01, right-click "FS01.test.contoso.com", select "Enable Replication".
30. On "Before You Begin" window, click "Next".
31. On "Specify Replica Server" windows, next to "Replica server", type "hvsvr02.test.contoso.com".


32. Click "Next".
33. On "Specify Connection Parameters" window, leave default settings.


By default, the data is compressed before transmitting.

34. Click "Next".
35. On "Choose Replication VHDs" screen, you can select which Virtual Hard Disks to be replicated.


36. Click "Next".
37. On "Configure Recovery History" window, select "Only the latest recovery point".


Remark: You can keep more than 1 recovery point by selecting "Additional recovery points". The maximum additional recovery point is 15. By default, the recovery point is created every 1 hour. For application consistent, we can also check "Replicate incremental VSS copy every" option.

38. Click "Next".
39. On "Choose Initial Replication Method" window, select "Send initial copy over the network".
40. Next to "Schedule Initial Replication", select "Start replication immediately".


41. Click "Next".
42. Click "Finish".
43. On "Enable Replication for FS01.test.contoso.com" popup window, click "Settings".


At production environment, the production network and the DR network are different. Hyper-V supports configure the networking for Failover TCP/IP after administrators enabled replication on the VM, I will configure the  Failover TCP/IP  for VM.

44. Expand "Network Adapter > Failover TCP/IP".


45. Check "Use the following IPv4 address scheme for the virtual machine".
46. Provide the IP address, Subnet mask, Default gateway and Preferred DNS server for testing.


Remark: "Failover TCP/IP" requires the OS to be installed the latest Integration Services and  Synthetic Network Adapters.

The one of the following operations system supports "Failover TCP/IP": Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003 SP2 (or higher), Windows 7, Windows Vista SP2 (or higher) and Windows XP SP2 (or higher).

47. Click "OK".


The initial copy is sending to HVSVR02.

48. When sending the initial copy finished, right-click "FS01.test.contoso.com", select "View Replication Health".


You can verify the replication health on the window.

Testing failover on the virtual machine
49.  On Hyper-V Manager of HVSVR02, right-click "FS01.test.contoso.com", select " Replication > Test Failover".


50. Click "Test Failover".
51. Right-click "FS01.test.contoso.com - Test", select "Start".

Remark: Make sure the virtual switch to be assigned on "FS01.test.contoso.com - Test".



"Failover TCP/IP" worked on the VM.

52. Right-click "FS01.test.contoso.com", select "Replication > Stop Test Failover".


53. Click "Stop Test Failover".

Planned failover on the virtual machine
54. On Hyper-V Manager of HVSVR01, right-click "FS01.test.contoso.com", select " Replication > Planned Failover".


55. Click "Fail  Over".


The VM cannot be failover because the VM is running. To perform failover, the VM need to shut down.

56. Click "Close".


57. Click "Cancel".
58. Shut down "FS01.test.contoso.com".
59. Right-click "FS01.test.contoso.com", select " Replication > Planned Failover".
60. Click "Fail  Over".
61. When the failover completed, click "Close".

Remark: "Planned Failover" configures the reverse the replication direction automatically.


62. Right-click "FS01.test.contoso.com", select " Replication > View Replication Health".


Now, the primary server is changed to HVSVR02 and the replica server is change to HVSVR01.

Remark: After failover, you need to update the "Failover TCP/IP" settings because the primary is changed.

Unplanned failover on the virtual machine
Assuming HVSVR02 has been down and then fail over the VM on HVSVR01.

63. Shut down HVSVR02.
64. On Hyper-V Manager of HVSVR01, right-click "FS01.test.contoso.com", select "Replication > Failover".
65. Click "Fail Over".


After failover, the VM started automatically.

66. Right-click "FS01.test.contoso.com", select "Replication > View Replication Health".


The primary server has been changed to HVSVR01 but the replication is stopped because HVSVR02 has been downed.

I will power on HVSVR02 and then configure "Reverse Replication".

67.Power on HVSVR02.
68. Right-click "FS01.test.contoso.com", select "Replication >  Reverse Replication".
69. On "Before You Begin" window, click "Next".
70. Next to "Replica server", type "HVSVR02.test.contoso.com".
71. Click "Next".
72. On "Specify Connection Parameters" window, select "Use Kerberos authentication (HTTP)" and check "Compress the data that is transmitted over the network".
73. Click "Next".
74. On "Configure Recovery History" window, select "Only the latest recovery point".
75. Click "Next".
76. On "Choose Initial Replication Method" window, select "Send initial copy over the network" and "Start replication immediately".
77. Click "Next".
78. Click "Finish".


The new initial copy of "FS01.test.contoso.comis sending to HVSVR02.

As a result, the data is replicated from HVSVR01 to HVSVR02.

Reference:
Hyper-V Replica Feature Overview

Deploy Hyper-V Replica

Understand and Troubleshoot Hyper-V Replica in Windows Server "8" Beta

This posting is provided “AS IS” with no warranties, and confers no rights!