One of the best features (IMHO) of Hyper-V in Windows Server 2012 is Hyper-V Replica. This feature allows you to replicate a running virtual machine on a Hyper-V server to another Hyper-V server, where it can be ready to be fired up in case of a failure at the primary server. The replication can happen as often as 5 minutes, thus providing an almost real time disaster recovery solution. The best part of this is that it is included out of the box in the Hyper-V role of WS2012.
There is an excellent reference called Poster Companion Reference – Hyper-V Replica available for download from Microsoft here – http://www.microsoft.com/en-us/download/details.aspx?id=29189. The diagram says it all.
So, from a small business perspective, how is this useful, cost effective, and can it be implemented with the limited resource constraints of the SMB budget?
For this to work, you need at least the following items.
- Two servers running Hyper-V as hosts in non-similar domains, or in workgroups. One of these would be the main server for the business. The second could be another server in the business OR it could be a server provided by your IT service organisation, who is offering a Disaster Recovery service for your business.
- A SSL Certificate for each Hyper-V server – both the primary and the replica servers. We will not be using Kerberos authorisation, because this only works in an Active Directory environment, where both servers are part of the domain. For our purposes, we are assuming a small business where we are happy to have one, let alone two servers running Hyper-V. In this case, there will most certainly not be a domain for the hosts. A domain controller in the virtual machines will not be helpful, since the hosts will not be able to authenticate with these DCs if they are not yet started.
How do we set this up? A summary of the steps taken are as follows:
- Configure the Hyper-V primary server and replica server names.
- Purchase the SSL Certificates. Install them on each of the servers.
- Enable Replication on the replica server.
- Select a VM to replicate and configure replication.
- Begin initial replication.
- Configure replication settings.
- Test failover.
Configure the server names
We need to configure the server names so that they are fully qualified domain names. This is needed in order to obtain a proper SSL certificate. Since these servers are not in a domain, any domain suffix which is accessible would be sufficient. Normally, you would use servername.yourdomain.com or similar. In order to quickly add a suffix to the domain name, you can take the following steps.
- Open up Server Manager
Go to Local Server and click on the computer name
Put in the Primary DNS suffix and click OK several times for the changes to take place
You will need to reboot the server. After that, the server name will include the full FQDN.
Changing the DNS suffix does not affect local access to the server. It merely allows the server to see itself with a fully qualified domain name, which should match the SSL certificate that is installed in the next step.
Purchase and Install the SSL Certificates
At this stage, you can obtain a SSL certificate from your favourite vendor. I use Trustico. After generating the certificate, you need to convert this into a PFX certificate and import this into the server.
If you have a certificate in a different format, there are tools that you can use to convert them. See my blog here for more information on this – http://blog.powerbiz.net.au/useful-links/ssl-certificate-tools/
Once you have the certificate, follow the instructions here to import the certificate into the server – http://blog.powerbiz.net.au/server-2012/importing-a-pfx-certificate-into-windows-server-2012/
Enable Replication on the Replica Server
Once these initial set up steps have been completed, the servers can be configured for replication following the standard guides to setting up Hyper-V Replica. A few good resources can be found here:
The first step is to enable replication on the Replica Server.
- Open Hyper-V Manager on the Replica Server
Click on Hyper-V Settings
Select Replication Configuration, and tick Enable this computer as a Replica server.
- Select Use certificate-based Authentication (HTTPS). You change the SSL port if you want, but you will also need to change this setting on your firewall as well
- Select the Certificate
- Allow replication from any authenticated server. You can specify the server if you want more security.
Click OK to complete the page.
Click OK to acknowledge that you need to configure the firewall.
Start the Windows Firewall with Advanced Security console
- Click on Inbound Rules
- Scroll down and select the entry Hyper-V Replica HTTPS Listener (TCP-In)
Click Enable Rule
Replication is now enabled on the Replica Server.
Enable Replication for each Virtual Machine on the Main Server
The final step is to enable replication for each virtual machine that needs to be replicated.
- Open the Hyper-V Manager
Select a virtual machine, and click Enable Replication to begin the Replication Wizard
Click Next. Type in the Replica server name (including the FQDN). If you have used a non DNS hosted FQDN, you will need to manually add in the entry into the HOSTS file.
Select the Certificate for the main server. If the DNS entries are not correct, and the replica server cannot be located by the wizard, you may get the warning listed below.
Select the drives that need to be replicated. It is possible to create a replica without replicating all the drives. Read the information panel for more information.
At this point, you can choose to select more than one recovery point, and customise the VSS schedule.
You can now select the initial replication method. The choices are self-explanatory. You can also schedule the initial replication so as not to cause bandwidth congestion.
Review the settings, then click Finish to complete the wizard. If there are no errors, replication will begin immediately unless scheduled for later.
On the Replica server, the virtual machine will be created in an Off state.
Once replication has completed, you can monitor the status of replication and perform other tasks from the Replication menu
- Repeat this for all the virtual machines
There are many factors and considerations when working with Hyper-V Replica, such as bandwidth utilisation, processor utilisation, and memory requirements. These will be investigated in another blog posting. Also, we will examine the management of the replicas and look at how to run failover testing.