A few months ago I wrote a post describing how disaster recovery can be achieved on a virtual environment through real time replication by using VMware Site Replication Manager (SRM). For those of you using Hyper-V and wondering whether something similar is possible on Microsoft's Windows Server platform you need not wonder anymore as it certainly is an available and mature feature that has been around for some time now and in this article we are going to show you how to go about configuring it.
Before delving into the setup the first thing you need to do is ensure that all the hypervisor hostnames and cluster names are resolving correctly in the DNS at each location. Replication in the Windows world relies heavily on Active Directory (AD) and DNS for permissions and name resolution. One more thing to ensure is that the host machines are on the same domain with the requisite administrator and Hyper-V user roles the same on each host. Finally, during replication the differential data will be sent over the HTTP and HTTPS ports therefore both ports 443 and 80 need to be open on the firewall between the hosts/clusters and no additional services should be listening on those ports on the Hyper-V host servers.
Replication on Hypervisors in a Failover Cluster
Virtual machines can be replicated directly from hypervisor to hypervisor (host to host) but if any of the hosts that will be participating in replication belong to a failover cluster then replication must be coordinated via a broker process instead of directly machine to machine.
The broker Hyper-V role will be responsible for scheduling the replication actions with the relevant Hyper-V hosts in the cluster. It is responsible for monitoring and detecting the node that is currently hosting the replicated VM and directing the replication data to this hypervisor or redirecting to another in the event that the VM is moved.
When configuring the role in Hyper-V Manager we will need to ensure that the role has permissions on all the objects in the cluster. One simple way of doing this is by creating a computer object in the same OU of the domain as the other cluster members and granting it permissions on all the servers in the failover cluster.
Login to the domain controller and launch the Active Directory Users and Computers application. Navigate to the OU directory containing the failover cluster and right click to create new computer object.
Fill in the required details as illustrated below.
After the broker computer object is created right click on this object and select properties then go to the security tab.
Enter the name of each computer object in the cluster and grant all administrative permissions to the broker on these objects.
Creating the Hyper-V Broker
Now that the permissions have been created we can go ahead and actually create the broker role on the cluster. Remember that this step and the preceding step are only necessary for Hyper-V hosts that are a part of a cluster. Additionally, if both sides participating in replication will be members of a cluster then this step and the previous one will need to be done at both ends.
Open the Failover Cluster Manager and select Configure Role in the popup menu when right clicking on the Roles sub group.
The High Availability Wizard will now appear. Select Hyper-V Replica Broker then click Next.
Follow the wizard and enter the values selected. Be sure to use the same name for the role as the computer object previously created. After the broker is created be sure to check that the status is listed as Running in Failover Cluster Manager. The broker will be listed by name under Roles section. In this demonstration our broker will be called "HV-Broker"
Once communication is verified between the Hyper-V hosts over ports 443 and 80 or between the hosts and the broker or broker to broker in a clustered environment we can proceed to enable replication for selected VMs. Replication is configured from the Hyper-V Manager, therefore our first step will be to open Hyper-V Manager.
The manager application can be found by searching the welcome screen or by launching the management snap-in from Server Manager on Windows Server.
To enable replication right click on the VM you intend to replicate and chose the Enable Replication option.
Alternatively you may select the host and display properties and navigate to Replication Configuration.
The replication wizard will now appear. Specify the replication server at the remote location where the VM will be copied.
The replication server should be the domain name of the remote Hyper-V host server or the remote broker. Leave the defaults for the authentication type and leave on data compression.
Feel free to chose values for your environment for the other variables such as VHD location and replication intervals and frequency.
After all the values are entered in the Enable Replication wizard replication will be started by default automatically unless the user selects otherwise. During initialization a full copy will be made of the entire VM at the primary site and transferred to the remote host. This may take some time but after the copy is completed then replication will proceed using only differential block data which is significantly smaller.
You may validate the progress of replication by checking on the replication status option under replication menu when right clicking on the VM in Hyper-V Manager.
A failover can also be initiated from the replication menu as well. During a failover the VM at the primary site is powered down and then the VM at the remote location is started and replication is paused.
To ensure a smooth transition the properties should be edited in the replication configuration for each VM to change the IP address to match the subnet at the remote site. However, this feature will only work for a Windows based virtual machine.
There you have it. That is all that there is to configuring replication using Hyper-V. A special thanks to my colleague Jevon Koomalsingh who helped me to troubleshoot and test this replication feature recently. For those interested in how this can be achieved on VMware check out the SRM feature.
Sign up to our mailing list to read more like this.
We value your time. You easily can unsubscribe at any time.