In my opinion the best feature of Windows Server 2012 Hyper-V is the Replication service.
Hyper-V Replica provides a way to replicate a Virtual Machine to another Hyper-V Host in case the primary Hyper-V hosts fails. The best part about Hyper-V replica is that it doesn’t require shared storage; just two 2012 Servers running Hyper-V. The following guide will walk you through the step by step processes of setting up Hyper-V replication in two windows 2012 servers:
Open the Server Manager and Add the destination server Using Add Server Wizard.
Then on both servers which you going to use for the replication scenario, just create a New Folder and right click on it and under Folder Properties just click the Sharing option. After that select the Advance Sharing option.
Under Folder Advance Sharing option add the administrator and give the full access permission to it. In my case I have joined both servers to MSCLOUD.COM domain and I have given the Full rights to MSCLOUD\Administrator. Do the Step 2 and 3 for the other server too.
After given the permission, open the Hyper-V Manager console in one server. In my case I have added the second server to my Hyper-V manager console to manage both using one console. Then in my case I am going to replicate one virtual machine from SRV-HV to Microsoft server. So first thing you have to do is enable the replication services for both Physical servers first.
Select the one server and click Hyper-V Settings as follows.
Under Hyper-V settings Enable Replication Configuration and Enable the Live Migration option as follows.
Under the Replication service Select the Enable this Computer as Replica Server. Then to communicate in a proper channel you can use either Port 80 or Port 443. But in my case I used Port 80 HTTP). If you need to use port 443 then you have to use a trusted certificated for both physical servers.
Once select the proper communication port Under Authentication and Storage Option select the Allow replication from the specified server option.
Then select the Add tab to specify the replica server details as follows.
Then under Authorization Wizard specify the replica server (Destination server)details and specify the file store location for replica files as well. For easy management you can create a Trust Group as well. For trust group creation you can mentioned and name you like.
The file location is the folder which you have created in step 2 and step 3.
After specify the details Press OK to continue and then it will give you a Warning Message to open the firewall port for communication ports. In my case I have to open port 80 within the firewall.
Next you need to Enable the Live Migration option. Using Live migration option you can do a Failover while having Planned down time. Make a note that enabling Hyper-V replica you can start up the Virtual machine from the destination server with planned downtime. This is not a migration which happens automatically. But I believe the time which going to up the Virtual machine from the destination is just a matter of time you going to access the Destination server and starting the Virtual Machine.
After you enable the Live Migration option You can use the Authentication Protocol you want.
Also you can specify the IP range which use for Live migration. In my case I have given the 172.21.13.0/24 range.
Follow the same steps from Step 4 to Step 10 for the second physical server as well. After enabling the Replication services in Physical Hyper-V servers you have to make sure the replication service is already enabled in the Virtual machine which you want to have a copy of replica. In my case I have selected the SCORCH VM which is running in SRV-HV.
Select the VM and go to settings of the VM as follows.
Make sure that the VM is using he correct port for the Replication service.
After confirming the setting just Right Click on the VM and select the Enable Replication option in Virtual Machine.
Once you select the Enable Replication option it will begin a new configuration wizard as follows. Click Next to continue.
Under Specify Replica Server wizard Select the Replica Server as follows. In my case my replica service is going to be a Microsoft.MSCLOUD.COM. And my Primary server is SRV-HV.MSCLOUD.COM.
In next step under Specify Connection Parameters wizard Select the Communication port and make sure the Replica Server is correct.
Note- Also make sure to compress the data when the files are replicating over the network. While enabling this option it will help you to reduce the Bandwidth utilization within the network.
On Choose Replication Wizard you can SKIP any .VHD file replicating to destination replica server. In my case I have only one .VHD file in my server and therefor I don’t have any .VHD file to skip of replicating. Click Next to continue.
On the Configure Recovery History option you can select the how many recovery points you need to store in the replica server. While have the additional number of recovery points you can recover the virtual machine to earlier point in time. Click Next t continue.
On the Chose Initial Replication Method you can select Send the Initial Copy of the Virtual Machine over the network, or if you feel it will take long time to copy the initial VM data to the replica server over the network then you have the option to copy the replica data first to external drive and then copy the data to replica server using it to expedite the process. Also you have the option to Schedule the replication as you want. Click Next to Continue.
On the Summary page verify the configuration settings you made and Click Finish to complete the Replication wizard.
Once you click Finish button it will give you a Message to let you know that the replication is enabled successfully on the selected virtual machine. Click Close button.
On the following screen you can see after enabling the replication service the SCORCH VM is sending the Initial replica copy to the destination Hyper-V replica server.
Once you select the destination replica server on the Hyper-V Manager console it shows that the SCORCH VM is created in the destination server and its Receiving the replica copy from the primary server.
After initial copy sent to the replica server successfully you can do the Planned Failover to test the replication as follows.
Click the Planned Failover option as follows.
Once you Click the failover option it will initially check the prerequisites and if everything is suitable it will start the Virtual machine in the replica server.
Congratulations….. you will have successfully created a Hyper-V replica server….. Enjoy!!!