Data is perhaps the most important asset of your business. In dealing with protecting your data today, you must account for conceivable data loss scenarios. The scale of a disaster may include a small amount of data loss to losing all the data in an entire site. In the latter scenario of potentially losing all the data in an entire site location, backups that also exist in that same site are not going to be of any real value. You need a way to get the production data that exists in a particular site, copied to a secondary, or disaster recovery (DR) location.

Virtual machine replication is the mechanism that allows site-level resiliency and helps to ensure business continuity involving a total site failure.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

In this post, we will take a look at the following:

  • What is Virtual Machine Replication?
  • What is Hyper-V Replication and how does it work?
  • What are the components that make Hyper-V replication possible?
  • How to configure Hyper-V VM replication?
  • Hyper-V Replication – Best Practices
  • Hyper-V Replication vs Backup

What is Virtual Machine (VM) Replication?

Virtual Machine replication is the process where you have a mechanism to take an exact copy of a virtual machine running in a particular site and copy the “VM replica” over to another “warm standby” virtual environment. This warm standby environment is generally a similarly configured hardware specification to the environment running the production workloads.

Download Banner

The general idea is that if the production site is taken offline by any number of disaster recovery scenarios, the secondary or DR site will be able to assume ownership of running the production workloads made possible by the replicated VM data.

Configure Hyper-V Replication

Replicating data from primary to replica site (Image courtesy of Microsoft)

What is Hyper-V Replication and How Does it Work?

Microsoft has designed Hyper-V replication to be a component of the Hyper-V role.

In the first Hyper-V versions including Windows Server 2008 Hyper-V, there was no built-in mechanism for Hyper-V virtual machine replication. However, with the release of Windows Server 2012, Hyper-V Replica was introduced.

The Hyper-V replica allows replicating Hyper-V virtual machines from one Hyper-V environment to another to protect your data at a site-level and help to ensure business continuity in case a disaster strikes and takes an entire site offline. This is accomplished by Hyper-V replication creating an exact virtual machine copy of the Hyper-V VM running in a different site.

There are some really nice features that go along with Hyper-V replication technology that allows the solution to be very flexible and powerful right out of the box.

This includes the following characteristics:

  • Hyper-V hosts used in Hyper-V replication can be located in the same facility (not recommended for site-level disaster recovery purposes) or in completely separate geographic regions that are connected by a relatively fast WAN connection.
  • Active Directory dependencies are not required for Hyper-V replication to function and the Hyper-V hosts do not even have to be joined to the domain
  • Change Tracking

    When Hyper-V replication is enabled on a specific Hyper-V virtual machine, a full copy of the virtual machine is copied across to the secondary site. This copy is identical to the virtual machine that is running in the primary location.

    After the initial copy is completed of the Hyper-V virtual machine, Hyper-V creates a file that serves to log the changes on the virtual machine VHD file. The log file is then replayed in reverse order over to the replicated Hyper-V virtual machine with the configured replication time interval settings.

    This asynchronous replication ensures the virtual machine is kept current according to the settings defined in the replication configuration. Additionally, for security, replication can take place over either HTTP or HTTPS.

  • Chain replication topologies together

    Hyper-V replication that is built into the solution can be “chained” together to form an extended replication topology. This means you can replicate Hyper-V virtual machines from the primary location to the secondary site, and then from the secondary site to another Hyper-V host. This serves to ensure even greater resiliency and lessen the chance of data loss.

    A limitation of this is that you cannot replicate directly from the 1st site to the 2nd and 3rd directly. It has to follow the “chain” of 1st to 2nd and then 2nd to 3rd. Another limitation of the extended replica is that it does not support application consistency like the 2nd site. This is because it is simply a direct copy of the secondary site’s VHD files.

  • Automated Failover Features

    One of the nice features of the Hyper-V replication built into the solution is the automated failover to replica virtual machines. With Hyper-V virtual machine replication, you can manually initiate failover tests, planned and unplanned failovers. The test feature is great in that it actually allows testing of failover operation which is absolutely critical to test before a disaster strikes.

Hyper-V Replication Requirements and Considerations

What are the prerequisites of Hyper-V replication?

There are several things to note before beginning the configuration of Hyper-V replication. The prerequisites include considerations that may need to be decided from a business standpoint, including what your SLA on data will be in the event of a disaster. This may very well affect how often you choose to synchronize your data with Hyper-V replication.

Hyper-V Replication Requirements

  • Windows Server 2012 or higher running the Hyper-V role
  • Sufficient storage in both your primary, secondary, and extended replication sites (if using) to support the Hyper-V replicas
  • General network connectivity between primary and other replicated sites
  • Sufficient network bandwidth to satisfactorily support Hyper-V replication and satisfy the determined synchronization intervals
  • Any necessary firewall exceptions between the primary and secondary/extended sites for replication communication
  • Trusted certificates are needed if you are using HTTPS replication

Hyper-V Replication Considerations

  • Deciding which VMs you want to replicate

    Since Hyper-V replication is enabled per virtual machine, businesses can choose which VMs are replicated from production to the secondary location. You can also exclude virtual hard disk VHD files from virtual machines being replicated. This is so that unneeded data is not replicated unnecessarily.

  • Decide the Hyper-V replication interval time period

    Hyper-V virtual machine replication allows virtual machines to be replicated in frequency from 30 seconds, 5 minutes, or 15 minutes. Depending on the criticality of the Hyper-V virtual machine, you may choose different settings for configured virtual machines being replicated. A business-critical server may need to be replicated every 30 seconds, while a less critical server may be replicated less often such as every 15 minutes.

  • Decide the number of recovery points to keep on the replicas

    By default the Hyper-V replica keeps one recovery point on the replicated Hyper-V virtual machines. You can choose to keep more with a maximum of 24 hourly points on a replicated virtual machine. The additional recovery points require additional processing and storage resources.

  • Decide initial replication method

    Hyper-V virtual machine replication provides a variety of ways to perform the initial replication of the virtual machine to the secondary location.

    • You can replicate a complete copy of the virtual machine over the network to the secondary location
    • You can restore a backup of a virtual machine to the secondary location and use this as the initial copy
    • Then, finally, you can copy the virtual machine to external media and then physically transport the external media to the secondary site and seeding it from the external media

What is the Hyper-V Replica Broker?

When configuring and setting up Hyper-V replication, there is a special role to be aware of that plays a critical role in Hyper-V replication. This is the Hyper-V Replica Broker role.

This role is needed with Hyper-V replication when either the primary or replica Hyper-V server is part of a Hyper-V Windows Failover cluster. The Hyper-V Replica Broker is responsible for the following aspects of the virtual machine replication process when a Failover Cluster is involved.

  • Initial Node Placement – When replication is enabled on the source virtual machine, the Hyper-V Replica Broker is contacted and after authentication takes place, the Replica Broker picks a random node from the cluster to place the virtual machine replica
  • Enabling High-Availability on the Replicated Virtual Machine – The Hyper-V Replica Broker is responsible for making the replicated virtual machine highly-available. This involves taking care of the replicated virtual machine if the chosen replication node fails. The virtual machine replica would be moved so the replication process can continue.
  • Redirect Replication Traffic – As virtual machines are migrated due to load or other reasons, the Hyper-V Replica Broker keeps up with the virtual machine and which node it resides on. If the replicated virtual machine is migrated to a different node, the Hyper-V Replica Broker notifies the replication process of where the virtual machine now resides so that replication can continue without issue.
  • Centralized management of the replication process – The Hyper-V Replica Broker helps to ensure centralized management of the replication settings. The Broker is responsible for writing the replication configuration to the cluster database and triggering a notification to any configuration changes. This helps to ensure that all nodes are aware of the latest and most recent replication settings.

Configure Hyper-V Replication

Hyper-V Replica Broker is needed when replicating to or from a Hyper-V Cluster (Image courtesy of Microsoft)

How to Enable Hyper-V Replication in Windows Server 2016

Microsoft has made the process of enabling replication on a Hyper-V virtual machines a very straightforward process with either the graphical GUI tools that are available for managing Hyper-V environments or by using the extremely powerful PowerShell scripting language.

The GUI tools involved with enabling Hyper-V virtual machine replication include using Hyper-V Manager as well as Failover Cluster Manager.

Let’s take a look at enabling Hyper-V replication in Windows Server 2016 first using Hyper-V Manager and Failover Cluster Manager and then look at how to enable Hyper-V replication using PowerShell.

As an overview, the process will look similar to the following:

  1. Enable the Replica Server
  2. Enable the Hyper-V Replica Broker role (if any hosts are part of a Hyper-V Cluster)
  3. Enable replication on the Hyper-V virtual machine

Enable Hyper-V Replica Server with Hyper-V Manager

If both of your Hyper-V environments (primary and secondary) are both standalone Hyper-V servers, the process is a bit simpler as you do not have to configure the Hyper-V Replica Broker role. However, if one of the environments is a Hyper-V Cluster, which is highly likely, you will also be required to use the Failover Cluster Manager tool to enable the Hyper-V Replica Broker role for the Hyper-V Cluster.

Let’s first take a look at the steps to enable replication on the replica server which is the server that will be replicated from the primary server running the production workloads.

  • Click Replication Configuration – Enabled as a Replica Server (Under Hyper-V Settings)
  • Click the check box next to Enable this computer as a Replica server
  • Select the Authentication and ports configuration which consists of choosing between HTTP and HTTPS and custom port if desired
  • Configure Authorization and storage to specify the servers that are allowed to replicate virtual machines to this computer. This allows restricting the servers that are allowed to replicate to the replica server.

Configure Hyper-V Replication

Enabling the Hyper-V Replica Server for the target of Hyper-V replication

How to Add the Hyper-V Replica Broker Role

As described in the “What is the Hyper-V Replica Broker” section, the Hyper-V Replica Broker is an extremely important role in the context of a Hyper-V Cluster. The Replica Broker manages the replication operations for virtual machines either coming from/to Hyper-V Clusters or both. The Hyper-V Replica Broker is enabled at the Hyper-V Cluster level by using the High Availability Wizard. In this, we will use Failover Cluster Manager to add the Hyper-V Replica Broker to a Hyper-V Cluster using the High Availability Wizard.

In the Failover Cluster Manager right-click your Hyper-V Cluster and select Configure Role.

Configure Hyper-V Replication

Configuring the Hyper-V Replica Broker role on a Hyper-V cluster

In the Select Role list, select Hyper-V Replica Broker and click Next.

Configure Hyper-V Replication

Selecting the Hyper-V Replica Broker in the High Availability Wizard

On the Client Access Point screen, set the NETBIOS name for the Hyper-V Replica Broker.

Configure Hyper-V Replication

Setting the Client Access Point NETBIOS name for the Hyper-V Replica Broker

On the Confirmation screen, you will see the Hyper-V Replica Broker information displayed for configuration. Click Next.

Configure Hyper-V Replication

Confirming Hyper-V Replica Broker configuration settings

On the Summary screen, the summary of information is displayed for the Hyper-V Replica Broker configuration. The Hyper-V Replica Role will now be brought online with the configured settings as a highly available clustered role.

Configure Hyper-V Replication

Summary screen for the Hyper-V Replica Broker Role

Enabling Hyper-V Virtual Machine Replication

Once you have the receiving Hyper-V Replica server configured, and the Hyper-V Replica Broker role configured (if you have Hyper-V nodes that are part of a Hyper-V cluster) you can enable Hyper-V virtual machine replication on your Hyper-V virtual machines.

To begin the Enable Replication wizard, right-click on a VM and select Enable Replication.

Configure Hyper-V Replication

Beginning the Enable Replication wizard on a specific Hyper-V VM

Configure Hyper-V Replication

Beginning the Hyper-V VM replication wizard

The first order is to Specify Replica Server which is specifying the name of the Hyper-V server that will receive the replicated virtual machine.

Configure Hyper-V Replication

Specify the Hyper-V Replica server

On the Specify Connection Parameters page of the wizard, select how you want the replication communication to happen, either over HTTP port 80 or using HTTPS with a secure certificate. For production, you should always encrypt your replication traffic. For simplicity in the walk through, we are choosing HTTP port 80.

Configure Hyper-V Replication

Selecting the connection settings for the Hyper-V replication communication

Choose the Replication VHDs. Here you can get granular about which specific VHD files are replicated for a particular Hyper-V VM. VMs that may have a disk that serves as a page file, etc, can be omitted from the replication process, thus saving processing time and space.

Configure Hyper-V Replication

Choose the specific VHDs you want to replicate

Configurer Replication Frequency allows configuring the intervals for which changed data will be replicated across to the replica target. The options here are 30 seconds, 5 minutes, and 15 minutes.

Configure Hyper-V Replication

Choose the replication frequency

You can also Configure Additional Recovery Points if you desire. By default, the replication process only keeps one recovery point. You can create a maximum of 24 hourly recovery points.

Configure Hyper-V Replication

Specify retention of recovery points on the Hyper-V replica

On the Choose Initial Replication Method, choose how you want the data to be seeded in the replication target. You can use a network copy or external media to seed the replica VM. You can also schedule initial replication times for off-peak network hours.

Configure Hyper-V Replication

Choose the initial replication method

Finally, on the Summary screen, review the configuration settings and make changes if needed before confirming.

Configure Hyper-V Replication

Summary of the Hyper-V VM replication settings

Enable Hyper-V Virtual Machine Replication with PowerShell

The PowerShell language is extremely powerful when it comes to interacting with Hyper-V environments. You can easily enable Hyper-V virtual machine replication with PowerShell with a one-liner PowerShell cmdlet. The cmdlet we are interested in is the Enable-VMReplication cmdlet. The cmdlet and parameters are listed below.

Enable-VMReplication

[-CimSession < CimSession[] >] [-ComputerName < String[] >] [-Credential < PSCredential[] >] [-VMName] < String[] > [-ReplicaServerName] < String > [-ReplicaServerPort] < Int32 > [-AuthenticationType] < ReplicationAuthenticationType > [-CertificateThumbprint < String >] [-CompressionEnabled < Boolean >] [-ReplicateHostKvpItems < Boolean >] [-BypassProxyServer < Boolean >] [-EnableWriteOrderPreservationAcrossDisks < Boolean >] [-VSSSnapshotFrequencyHour < Int32 >] [-RecoveryHistory < Int32 >] [-ReplicationFrequencySec < Int32 >] [-ExcludedVhd < HardDiskDrive[] >] [-ExcludedVhdPath < String[] >] [-AutoResynchronizeEnabled < Boolean >] [-AutoResynchronizeIntervalStart < TimeSpan >] [-AutoResynchronizeIntervalEnd < TimeSpan >] [-AsJob] [-Passthru] [-WhatIf] [-Confirm] [< CommonParameters >]

To enable basic Hyper-V VM replication using the cmdlet you can run the cmdlet:
Enable-VMReplication < your VM > < your replica server > 80 Kerberos

To perform the same replication configuration as shown in the preceding Enable Replication wizard, can easily be accomplished with a simple one line PowerShell cmdlet:

Configure Hyper-V Replication

Enabling Hyper-V Replication using PowerShell

Hyper-V Replication Best Practices

When working with any technology, you want to implement it according to recommended best practices. This ensures that your system is stable, performs as expected, and is supported. Hyper-V replication is no exception to this rule. You want to make sure you follow the recommended best practices when it comes to implementing Hyper-V replication.

What are the recommendations for Hyper-V replication?

  • Use the Capacity Planner for Hyper-V Replica – This tool allows designing the server, storage, and network infrastructure which is required to successfully deploy Hyper-V Replica.
  • Configure the appropriate firewall rules needed for the replication traffic. As shown, this can be configured by default on port 80 or 443. Custom ports can be used as well. Whatever ports are chosen, the inbound traffic on the firewall needs to be configured to allow the specified port.
  • Use HTTPs for replication traffic – Securing network communication is essential for overall security. It is highly recommended to use HTTPS for replication traffic so the traffic is encrypted with a proper SSL certificate.
  • Use compression on replication traffic – This makes the replication traffic much more efficient and the network footprint much smaller.
  • Use Application-consistent replication so applications are replicated in a consistent manner.
  • Make sure Integration services are installed on the source Hyper-V virtual machines.
  • Exclude unneeded VHD files from source replicated Hyper-V virtual machines.
  • Remember to install the Hyper-V Replica Broker role if a cluster is involved in either the source or replica destination.
  • Test your failover process before you actually have to use your Hyper-V replicas. This will help to flush out any issues with the replication and failover process.

Hyper-V Replication vs Backup

Is Hyper-V replication a replacement or alternative for backup?

No. Backups are still absolutely necessary and critical for protecting business-critical data.

Backups provide immediate recovery within the same site for a number of different data loss scenarios. These include accidental or intentional file deletion by end users, ransomware infection that corrupts a number of files, or a virtual machine that isn’t bootable. Backups protect your organization from any number of data loss events that fall in this category. Additionally, you may have a much greater number of recovery points configured for your VM backups that allow pulling from a diverse set of recovery points for specific versions of files.

Replication serves the purpose of protecting your business from a complete site-level failure. By replicating exact copies of your virtual machines to the secondary environment, production workloads can be failed over to the secondary site. This enables business continuity to continue even with an entire site down.

The reality is you need both backups and replication to have a robust and effective BC/DR strategy. By having a solution featuring both mechanisms, you can be protected from a wide variety of data loss events and a varying levels of disaster scopes. Mixing both in your disaster recovery strategy also helps you to satisfy the 3-2-1 best practice backup methodology. This specifies that you want to have at least (3) copies of your backup data, stored on (2) different kinds of medium, with at least (1) offsite.

Vembu BDR Suite is one such solution provides both enterprise backup and replication features for Hyper-V and Hyper-V clusters. Also, you’ll be able to implement the 3-2-1 strategy in your environment.

Vembu also provides a fully-featured free Hyper-V backup solution that provides unlimited backups for Hyper-V virtual machines. Using Vembu BDR Suite to protect your Hyper-V environment allows you to have the best possible protection for your Hyper-V environment.

Be sure to download a fully-featured trial version of Vembu BDR Suite for testing out the powerful backup and replication options you get for Microsoft Hyper-V.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

4/5 - (1 vote)