05 March 2014

Hyper-V Cluster to Cluster replication

Hyper-V replication is a great feature that is normally associate with Disaster Recovery (DR)  It is also widely employed as an alternative to having a fail-over cluster.  The thinking being that you have a warm backup of the machine only a few seconds behind the live server, effectively giving you a more current "backup."

In this article I am going to cover configuring replication form one cluster to another.  As you will see there are a few additional consideration and advantages compared to stand alone servers.

What can replicate to what
Replication is very versatile on that you can configure replication between the following:

  • Host to Host
  • HA Cluster VM to Host
  • Host to HA Cluster VM
  • HA Cluster VM to HA Cluster VM
You cannot replicate the following:
  • You have the limitation of not being able to replicate a cluster vm that is not HA.
  • You cannot replicate within the same cluster.  

Thy Hyper-V Replica Broker
Because virtual machine can move between hosts in a cluster environment you need the replica broker to ensure that the replication remains intact regardless of the host changes.

  • From the Server manager
  • Open Fail-over cluster manager and connect to the cluster
  • Select the Roles node
  • Click Configure Role
  • Select Hyper-V Replica Broker
  • Specify the Client Access Point - this is and additional name and IP that will be used be the cluster
  • Complete the wizard

Repeat for the second cluster

Configuring Replication
By default replication is not enabled. you need to turn it on for the cluster.

  • From the fail-over cluster manager 
  • Select the Hyper-V Replica Broker and right click
  • Select Replication settings
  • Check the "Enable the Cluster as a replica server
  • Check "Use Kerberos" for Authentication
  • Select allow replication from any authenticated server
  • Specify a default location to store the files. This should be on one of the CSV volumes.
  • OK

You will be notified to allow inbound firewall rules for the replication.
This has to be enabled on  each cluster node.  The easiest way of doing it is with a power shell command
Simply specify the clusternodes

Invoke-Command -computer hyperv06,hyperv07,hyperv08 {Enable-NetFirewallRule -Displaygroup "Hyper-V Replica HTTP"}

Set up replication for a virtual machine
Replication is a per-vm configuration so each one need to be specified

  • From the fail-over cluster manager 
  • Select the roles node
  • Select the virtual machine you would like to replicate and right click
  • Select Replication > Enable replication
  • Instead of specifying a replica server or cluster you need to specify the Replica Broker you created earlier
  • The connection parameters should all be detected correctly
  • Choose the replica VHDs
  • Configure the replication frequency (30 seconds, 5 minutes or 15 minutes)
  • Specify additional recovery points (governed by backup frequency)
  • Specify Initial replication. Select network unless it is not suitable.

The initial replication is when the build of the data will be transferred everything all subsequent replication is only the delta and is generally speaking relatively small.

  • Unless it is not suitable select Start Replication Immediately
  • Finish the wizard

Checking in on your replica
You can now check the Replica status by selecting the virtual machine and expanding the properties windows below

You can also view replica status form within System Center Virtual Machine Manager (SCVMM)  You can enable two additional columns.  Replication Status and Health.  It will also change the icon of the secondary or replica server.

Migrating the replica source
The virtual machine can be migrated between hosts in the same cluster without breaking replication.

This is done through the fail-over cluster manager.

  • Select Roles
  • Select the VM
  • Move - Live Migration - Select Node
  • Wait for the migration to complete

If you check the replication details you will notice that the current primary server has changed.

This can also be done from withing SCVMM

  • Open the cluster
  • Select the VM that is the replication source
  • Right Click - Migrate

You will see that only the current host has a PRO start rating.  the other cluster nodes have none.  The Rating Explanation is:

The virtual machine ... which requires Hyper-V Recovery Manager protection is going to be moved using type "Live". This could break the recovery protection status of the virtual machine.

  • This can be ignored by clicking Next

This migration happens as expected and the replication partner still remains intact.

Migrating the replica destination
Some times you might want to leave the replica source where it is and simply change the node to which it is replicated.  The process is exactly the same as above except the steps are performed on the replica rather than the source.

Migrating into and out of a fail-over cluster
When you enable replication between a cluster and a stand alone host some changes are assumed and made on your behalf.

When an HA VM is replicated to a standalone server it is automatically converted to being a normal non HA VM.

The opposite happens when replicating into a cluster.  The VM is configured as an HA VM with all it's bits stored in the shared storage.