A guide to configuring Hyper-V Replica

If you want to read a more comprehensive guide, check out our most recent article about Replication in Hyper-V. In this page we will learn how to enable and use Hyper-V Replica.

Requirements for enabling Hyper-V Replica

Please have the following environments ready before proceeding with other steps:

  • Active Directory Domain Services installed on a separate computer.
  • A Primary Server running on Windows Server 2012 with Hyper-V role enabled. Referred as PS1 in this article.
  • A Replica Server running on Windows Server 2012 with Hyper-V role enabled. Referred as RS1 in this article
  • A virtual machine running on the Primary Server. This virtual machine is referred as VM1 in this article.
  • Both PS1 and RS1 servers are configured as a member server in the domain.

Note: Although Active Directory Domain Services is not required for Hyper-V Replica but for this article we will be configuring Hyper-V Replica in an active directory domain.

Configuring Hyper-V Replica

Configuring Hyper-V Replica is easy as pie! There are at least three configuration steps required to implement and configure replication of virtual machines as described below:

  • Enabling Hyper-V Replica feature on Replica Server
  • Enabling Hyper-V Replica Firewall Rules
  • Configuring a Virtual Machine for replication
  • Excluding paging file from Hyper-V Replication

Note: Step “Excluding paging file from Hyper-V Replication” is optional but it is recommended to avoid unnecessary replication traffic.

Enabling Hyper-V Replica feature on Replica Server

As part of this step, you will configure Hyper-V Replica on a Replica Server running in the disaster recovery site.

1. From Hyper-V Manager UI on the RS1 server, click on “Hyper-V Settings” and then go to “Replication Configuration” as shown in the below screenshot:

 Hyper-V settings screenshot

2. Check “Enable this computer as a Replica server” to enable this computer as a Replica Server. This computer (RS1) will receive the replication from Primary Server (PS1).

3. In “Authentication and ports” page, select “Use Kerberos (HTTP)” as shown in the above screenshot.

Note: Primary and Replica servers can be configured to authenticate using one of two authentication protocols; HTTP or HTTPS, which uses network port 80 and 443 respectively.

1. In “Authorization and storage” page, select “Allow replication from any authorized server” option to enable this server to receive Hyper-V replication traffic from any Primary Server.

2. Leave all the options as is and click on “Apply” or “Ok” to configure RS1 server as a Replica Server. Once configured, this server is ready to receive replication of virtual machines.

Next is to enable Hyper-V Replica firewall rules.

Enabling Hyper-V Replica Firewall Rules

Windows Firewall Rules are already created but not enabled. You must enable the firewall rules so the Replica Server and Primary Server can communicate and participate in the replication use the below steps:

1. Go to Control Panel > open Windows Firewall

2. Search for the following firewall rules:

  • Hyper-V Replica HTTP Listener (TCP-In)
  • Hyper-V Replica HTTPS Listener (TCP-In)

3. To enable the above firewall rules, multi-select both the rules, Right Click and then select “Enable Rule

Note: You can also use the Powershell command below to enable the rules:

  • Enable-Netfirewallrule -displayname “Hyper-V Replica HTTPS Listener (TCP-In)”

The next section is to configure a virtual machine for Hyper-V Replication on the Primary Server.

Configuring a Virtual Machine for Replication

3rd step for the overall configuration of Hyper-V replica requires you to enable a virtual machine for replication. The virtual machine can be enabled for replication by using the following steps.

Note: The virtual machine, once enabled for Hyper-V replication is called “Primary Virtual Machine”.

1. Right Click on any of the virtual machines running on the Primary Server, and click “Enable Replication” as shown in the below screenshot:

 Configuring a virtual machine for replication screenshot

2. When you click on “Enable Replication”, it brings the “Virtual Machine Replication Wizard” as shown in the below screenshot:

 Screenshot of Virtual Machine Replication Wizard

In the wizard, you can specify the following options:

  • Specify Replica Server

In this configuration page, you can specify the Hyper-V Replica Server name which will receive the replication of this virtual machine. The DNS Server will be queried to resolve the Replica Server to FQDN name as shown in the below screenshot:

 Screenshot of specifying the Replica server in Hyper-V

  • Specify Connection Parameters

In the “Specify Connection Parameters” configuration page, click next.

  • Choose Replication VHDs

“Choose Replication VHDs” configuration page allows you to select/deselect the VHD files for Hyper-V replication. You can unselect the VHD files which you do not want to replicate to the Replica Server as shown the below screenshot:

 Screenshot of choosing replication VHDs

Note: There are two important items you need to consider before enabling replication for all or selected VHD files of a virtual machine:

  • Since replication for non-important VHD files might impact the network traffic if replication happens over a slow WAN link, It is recommended to enable the replication only the important VHD files.
  • Secondly, Since any application running on the virtual machine can use the paging file for its operation, the Primary Server tracks this as a change in the virtual machine. It is recommended to exclude the paging file from replication.

The steps for disabling the replication for paging file is highlighted in the “Excluding paging file from Hyper-V Replication” of this article.

  • Configure Recovery History

“Configure Recovery History” configuration page in the wizard allows you to select the recovery points and how many recovery points you want to maintain for “Standard Replica” and “Application-Consistent” snapshots.

Select “Only the latest recovery point” option if you need only one backup copy. Selecting “Additional recovery points” allow you to have additional backup copies.

“Standard Replica” is created for the entire virtual machine whenever there is any change to the virtual machine’s VHD files. “Application-Consistent” snapshot is a point-in-time copy which is created every 1 hour but you can set the interval of your choice by moving the slider as shown in the below screenshot:

 Screenshot of configure recovery history

  • Choose Initial Replication Method

Choose Initiatel Replication Method” configuration page provides options for copying Primary Virtual Machine to Replica Server initially. There are three options available for you to choose as shown in the below screenshot:

 Screenshot of choose initial replication method

Choose “Send initial copy over the network” option if you need to send the virtual machine including VHD files and configuration files to the replica server over a network.

Selecting “Send initial copy using external media” option allows you to export the virtual machine in a location you specify in the text box. Once it has been exported, the virtual machine can be imported at Replica Server.

The option “Use an existing virtual machine on the Replica server as the initial copy” can be used if you have already configured the same virtual machine on the Replica Server.

You can start the virtual machine replication immediately or at a scheduled defined by you as shown in the above screenshot.

3. Once you are done, click on “Finish” button to enable replication for this virtual machine. You can see the status of the virtual machine replication in the Hyper-V Manager UI.

Excluding paging file from Hyper-V Replication

Once the virtual machine is configured for Hyper-V replication, please perform the steps below to exclude the paging file from replication.

  1. Shut Down the Primary Virtual Machine on PS1
  2. Create a new VHD file and attach it to the Virtual Machine.
  3. Restart Virtual Machine and configure the new VHD file as a new partition using disk management snap-in.
  4. Relocate the paging file to the new drive.
  5. Once done, break the Hyper-V replication for this virtual machine by selecting “Remove replication” action located on the Right Click menu of the virtual machine.
  6. Once replication is removed for the virtual machine, perform the steps in section “Configuring a Virtual Machine for Replication” of this article. In the “Choose Replication VHDs” configuration page, do not select the VHD file which contains paging file.

This way the replication will not happen for the VHD file which contains the paging file.

Implementing Hyper-V replica environment is very easy as it just requires three configuration steps on the Replica Server and Primary Server. Once the replication is configured for a virtual machine, we must perform some tests to ensure Hyper-V Replication for the virtual machine is working as expected. In the part IV of this series, we will focus primarily on why Hyper-V Replica should not be considered as a replacement for Hyper-V backup but in Part IV of this article series, we are going to learn different types of failovers available with Hyper-V Replica and how to use them.

 

Altaro Hyper-V Backup
Share this post

Not a DOJO Member yet?

Join thousands of other IT pros and receive a weekly roundup email with the latest content & updates!

5 thoughts on "A guide to configuring Hyper-V Replica"

  • Simon says:

    Great series of articles however point 1 on Enabling Hyper-V Replica feature on Replica Server says ‘1. From Hyper-V Manager UI on the PS1 server’. Shouldn’t that read RS1 server?

  • Hi, my name is Sakhi, I have moved a replication server to the DR Site and it took a while to get to the other side now I want to use portable drive to catch up with the data that got updated while the machine was on the way as it is too big to go through my line

    • Zoran says:

      Hi Sakhi,
      Copying large amounts of data for the initial replication is a common problem a lot of organizations face. Microsoft Azure even lets you ship disks to their datacenter and they’ll upload them for you! In the case of Hyper-V Replica, you’ll want to select “Export Initial Replica” to copy the data to your portable drive, then “Import Initial Replica” on your recover site.

      Thanks,
      Symon Perriman
      Altaro Editor

Leave a comment or ask a question

Your email address will not be published. Required fields are marked *

Your email address will not be published.

Notify me of follow-up replies via email

Yes, I would like to receive new blog posts by email

What is the color of grass?

Please note: If you’re not already a member on the Dojo Forums you will create a new account and receive an activation email.

Webinar M365 Security Configurations