Need a Server? Build it in the cloud for free


Hyper-V Replica Step-By-Step #VirtExpert Virtualization Experts (Series Part 22)

Hyper-V 3 which is built into both the Free Hyper-V Server 2012 and Windows Server 2012 (Standard and Datacenter) which you can evaluate for free (free ISO, free VHD), has some really awesome capabilities.  You can read more about Hyper-V in the overview of the Server Virtualization Expert Series: Hyper-V Basics.  In this article, we are going to drill down into the newest, and to many people the most exciting technology in Hyper-v.  A feature called Hyper-V Replica.  In addition in keeping with the theme of the Server Virtualization Expert Series we will sprinkle in Step-By-Step & How-To’s so you can do it yourself.


Please Tweet:  @ITProGuru #VirtExpert Reading Hyper-V Replica thru Virt Expert Blog Series 

Understanding Hyper-V Replica

Hyper-V Replica is new in Windows Server 2012. It is an asynchronous, virtual machine replication technology that is designed for business continuity and disaster recovery.
Using Hyper-V Replica, you can replicate a virtual machine from one location to another using just Hyper-V and a network connection, as illustrated in the following diagram. Hyper-V Replica works with any server vendor, any network vendor, or any storage vendor. Also, unlimited replication is available out of the box.

  • image


Hyper-V Replica Benefits

Hyper-V Replica can provide the following benefits to your organization:

  • Hyper-V Replica allows you, in the event of a failure at a primary site (for example, fire, power outage, or server failure), to fail over your production workloads to Replica servers at a secondary location with minimal downtime.
  • Configurations for the Hyper-V Replica server and storage hardware at each site do not have to be identical. Domain membership is also not required.
  • Hyper-V Replica provides the option to restore virtualized workloads to a point in time, depending on the recovery history selections for the virtual machine.
  • Hyper-V Replica provides the necessary management APIs that enable IT management vendors to build an enterprise disaster recovery solution for their customers.
  • Hyper-V Replica enables Infrastructure as a Service (IaaS) for hosting providers that host dedicated virtual servers for their customers.


Replica Server Requirements

You can use Hyper-V Replica on hardware certified for Windows Server 2012. To take advantage of Hyper-V Replica, which is included as part of the Hyper-V server role, the following prerequisites must be met:

  • Hardware that supports the Hyper-V role on Windows Server 2012. Keep in mind that hardware-assisted virtualization is available in processors that include a virtualization option—specifically processors with Intel Virtualization Technology (Intel VT) or AMD Virtualization (AMD-V) technology. In addition, hardware-enforced Data Execution Prevention (DEP) must be available and enabled.
  • Sufficient storage on both the primary server and Replica server to host the files used by virtualized workloads.
  • Network connectivity between the locations hosting the primary and Replica servers.
  • Properly configured firewall rules to permit replication between the primary and Replica sites.
  • You need to use certificate-based authentication if you want transmitted data to be encrypted. Use an X.509 v3 certificate to support mutual authentication with certificates.

See Configure BIOS Before Installing Windows Server 2012 and Hyper-V for Step-By-Step on how to setup the BIOS for Hyper-V

Hyper-V Installation Considerations

Consider the following as you are learning about Hyper-V Replica. For more information, see Install the Hyper-V Role and Configure a Virtual Machine.  See for a Step-By-Step Guide on How to Install Windows Server and How To Enable and Configure Hyper-V.

  • Hyper-V Replica is implemented as part of the Hyper-V role. You can enable the Hyper-V role on a stand-alone server running Hyper-V or on servers that are members of a failover cluster. Servers running Hyper-V can function as members of a workgroup, or as member servers in the same or different Active Directory domains.
  • The primary and Replica servers do not need to be part of the same Active Directory domain unless the Hyper-V role is enabled on servers that are members of a failover cluster.
  • You can enable the Hyper-V role using Server Manager or using Windows PowerShell. The Hyper-V role has no dependencies on any other server roles. Installing the Hyper-V role also installs Hyper-V Manager (which is included in Remote Server Administration Tools (RSAT)).


Hyper-V Replica Terms and Definitions

  • Replication – The ongoing process of sending data changes that have occurred on a primary virtual machine to the equivalent Replica virtual machine.
  • Primary Server – The server running Hyper-V that hosts your virtualized production workloads.
  • Primary Virtual Machine – A virtual machine running on the primary server that is participating in Hyper-V replication.
  • Replica server – The server that hosts virtual machines that is maintained in reserve in the event that the primary server (and its primary virtual machines) must go offline.  The Replica virtual machines are kept up to date with any changes that occur on the primary virtual machines by the process of replication.  You can configure and manage Replica servers using Hyper-V Manager or Windows PowerShell.
  • Replica virtual machine – A virtual machine running on the Replica server that receives changes that are detected on the corresponding primary virtual machine.
  • Planned Failover – A controlled event where you move a virtual machine from the primary site to the Replica site.
  • Unplanned Failover – An unplanned event that occurs when the primary site experiences a problem and the Replica virtual machines are brought online at the Replica site.
  • Application-Consistent Replication – Replication that allows recovery to a point in time that is consistent from the perspective of applications. To accomplish this, the Volume Shadow Copy Service (VSS) is used.


Hyper-V Replica and Live Migration

Some people are initially confused about when to use Hyper-V Replica and when to use Hyper-V live migration. Hyper-V Replica keeps up-to-date copies of your virtual machines in case of a disaster, and allows you to switch to those copies when required. This is usually an unplanned event (although you can perform a planned failover with Hyper-V Replica, as described in the Hyper-V Replica Terms above). However, Hyper-V live migration is about planned events—moving your virtual machines and their associated storage across different locations when required. For more information about live migration in Windows Server 2012, see What’s New in Hyper-V.


Virtual Machine Replication

The great advantage of Hyper-V Replica is that it provides virtual machine replication for any of your servers, networks, or storage vendors. It does not require a failover cluster or any shared storage. You can replicate individual or multiple virtual machines.

You can replicate your virtual machines from one computer running Hyper-V at a primary site (the primary server) to another computer running Hyper-V at a Replica site (the Replica server). Keep in mind that your Replica server can accept incoming replication traffic from one or more primary servers. This is illustrated below:

The great advantage of Hyper-V Replica is that it provides virtual machine replication for any of your servers, networks, or storage vendors. It does not require a failover cluster or any shared storage. You can replicate individual or multiple virtual machines. You can replicate your virtual machines from one computer running Hyper-V at a primary site (the primary server) to another computer running Hyper-V at a Replica site (the Replica server). Keep in mind that your Replica server can accept incoming replication traffic from one or more primary servers. This is illustrated below:



Replicating Virtual Machine Changes

After you have configured and performed the initial virtual machine replication, Hyper-V Replica sends out virtual machine changes on a frequent schedule. These changes are tracked in a log file, which is compressed before it is sent to the Replica server. On the primary server, changes are maintained in an “.hrl” file that is in the same location as the VHDs that are being replicated. You can compress the virtual machine data when you replicate virtual machine changes across the network.



Enabling Replication on the Replica Server

Before you can use Hyper-V Replica, you must enable your server running Hyper-V to be a Replica server. After you set up your Replica server, it can accept incoming replication traffic from the virtual machines on one or more primary servers.
You can enable a Replica server using Hyper-V Manager or Windows PowerShell. It is not necessary to independently remotely connect to your Replica server to perform this configuration.

Enable replication on WS2012VMHost1using PowerShell

Powershell might look something like this: {where WS2012VMHost1 is your host name AND C:\Replica is where you want to store the replica’s}

To enable replication on host machines, type the following commands and press ENTER.


Enable replication on ServerName using GUI

  1. In Server Manager, click Tools, and then click Hyper-V Manager.Hyper-V-Replica-GUI
  2. In the Actions pan, click Connect to Server (right pane), type ServerName, and then click OK.  (or just click the server name if it is already there)
  3. Click Hyper-V Manager.
  4. Click ServerName.
  5. Click Hyper-V Settings (right pane)
  6. Click Replication Configuration (left pane)
  7. Turn on Checkbox to “Enable this computer as a Replica server
  8. Make sure Use Kerberos (HTTP): is checked Specify the port:  80
  9. Click Allow replication from any authenticated server
  10. Type the location you would like to put replicas eg D:\ReplicaTarget\  NOTE:
  11. Note: Replica Server Authorization
    After you have decided upon authentication types, you must specify which primary servers are permitted to replicate virtual machines to your Replica server. You can allow authorization from any authenticated server, or you can specify a primary server. In both cases, Hyper-V Replica allows you to designate a specific location to store your recovery virtual machine files—for example, on a SAN, on an SMB file server, or using direct-attached storage
  12. Click OK
  13. Configure Firewall

Replication Firewall Rules

    Properly configured firewall rules permit replication between the primary and Replica servers and sites. To allow any incoming virtual machine replication traffic for configured replication ports, you must ensure an inbound firewall rule is created.

  • Start – type: Control Panel- click Control PanelSystem and SecurityWindows FirewallAdvanced Settings – Inbound Rules
  • Hyper-V Replica HTTP Listener (TCP-In)Right Click and Select Enable Rule (make sure you enable the rule for the proper network)
  • Hyper-V Replica HTTPS Listener (TCP-In)Right Click and Select Enable Rule (make sure you enable the rule for the proper network)
  • image
  • Close Windows Firewall with Advanced Security

Initial Virtual Machine Replication

Using Hyper-V Replica, an initial copy of all your virtual hard disks (VHDs) must be transferred to the Replica server (at your Replica site). This operation needs to happen before regular replication operations can start. Hyper-V Replica provides three different options for initial virtual machine replication.

  • The first option is to transfer your selected virtual hard disks over the network to your Replica server. Using network replication, you can start your initial replication immediately or schedule it to happen at a specified time.
  • Hyper-V Replica also gives you the option of using an existing backup copy on the Replica server. This means you can transfer a backup copy of your production virtual machine to your Replica server.
  • Finally, Hyper-V Replica gives you the option of using external media. You can copy your selected VHDs to external media and deliver the external media to the Replica site. This is especially useful if your business operates in areas of expensive connectivity, or if you have to manage remote or regional server locations.

Initial Virtual Machine Replication – Step-By-Step

Initial Virtual Machine Replication is done by:

  1. In Hyper-V Manager, Select the Virtual Machine you wish to Replicate
  2. In Task Pane (right Pane) select Enable Replication (this is also available on the right click menu)
  3. Click Next on Before You Begin
  4. Type or Browse to the Replica Server (remember, this is the name of the destination server that will receive the replica) then Click Next
  5. Make sure Compress the data that is transmitted over the network is turned ON.
    • image then Click Next
    • Replica Server Authentication – After you enable a Replica server for virtual machine replication, you configure specific authentication types and ports for incoming replication traffic.
      You have two authentication options. You can use Kerberos authentication (using HTTP), but the data you send across the network will not be encrypted. You can also choose certificate-based authentication (using HTTPS), and the data sent across the network will be encrypted.
  6. Chose Recovery History options as desired (eg. Additional Recover Points = 4, Replicate incremental VSS every 4 hours)
      • image then Click Next

    Recovery History
    If you need to restore a virtual machine, Hyper-V uses a recovery point. The recovery points contain one or more snapshots. You have the option of just keeping the latest recovery point for restoring your primary virtual machine on the Replica server, or you can choose to maintain multiple recovery points on your server. If you choose multiple recovery points, keep in mind that you will need more storage on the Replica server. When you specify the number of recovery points you want to keep, the Enable Replication Wizard specifies how much storage is needed. Recovery points are created every hour, but the Replica server receives frequent and regular changes from the primary server, so that your primary and Replica servers stay synchronized.

    It is important to understand that if multiple recovery points are not configured, your server will only maintain the latest recovery point for the Replica virtual machine.

    You can also choose to take application-consistent snapshots at a specified interval. They use the Volume Shadow Copy Service (VSS). This is useful, but keep in mind that when you take snapshots of your applications running on the primary virtual machine, it will have a performance impact on those applications as the snapshots are created.

  7. Click Send initial copy over the network and Start replication immediately
    • image then Click Next
  8. Turn on the drives you want to replicate (usually all)
    • image then Click Finish



Hyper-V Replica Failover Operations

Hyper-V Replica is designed to help you in both planned (scheduled events) and unplanned (disaster recovery) failover situations. With Hyper-V Replica, you can fail over to a protected virtual machine on the Replica server at any time. There are three main options you need to understand for failover operations. Note that you can configure and manage Replica servers using Hyper-V Manager or Windows PowerShell.  More coming soon.

  • Planned Failover to a Replica Server
    A planned failover operation enables you to fail over your production virtual machine to a Replica server as part of a predetermined schedule. You might want to do this for multiple reasons—for example, to test the state of your Replica virtual machine. This allows you to make appropriate arrangements in your organization if they are required. We recommend that you perform planned failovers for off-business hours.
    There are several prerequisites when you perform a planned failover. Your virtual machine must not be running, and your server running Hyper-V at the primary site must be enabled to receive replication traffic from the Replica server. Keep in mind that a planned failover also initiates a “reverse replication.” Reverse replication is the process where replication is established from a virtual machine that was formerly a Replica virtual machine, but is now a primary virtual machine as the result of a failover. You can also perform a planned failover using Windows PowerShell.
  • Test Failover to a Replica Server
    Hyper-V Replica is continually updating the Replica server to ensure that the primary virtual machine matches the Replica virtual machine as closely as possible. If you want to, you can test a Replica virtual machine on the Replica server. You can conduct a test failover operation at any time without interrupting ongoing replication. This process creates and starts a virtual machine with the name “<virtual machine name> – Test”.
  • Unplanned Failover to a Replica Server
    In the event of a failure in the primary site, you can bring up the Replica virtual machine on the Replica server. When you configured your Replica server in the Enable Replication Wizard, you had the option of specifying multiple recovery points. Now, you can select the one you require to restore the specified the virtual machine. You can also start your Replica virtual machine in an unplanned failover using Windows PowerShell.

Watch for a Hands-on-Lab with Step-By-Step instructions coming very soon!


Windows PowerShell Cmdlets for Hyper-V Replica

Windows PowerShell is an integral part of Windows Server 2012 and can be used to build, administer, and troubleshoot your own environment.
We have published a list of Windows PowerShell cmdlets for managing Replica servers. See the Hyper-V cmdlet reference, which includes cmdlet descriptions, syntax, and examples.

Hyper-V Replica Visually


Double-Click to see Full Screen

PLEASE… GIVE US FEEDBACK!  What do you think of Hyper-V Replica?  Will you be using it?  When and Why?



Windows Server 2012 Hyper-V Component Architecture Poster and Companion References

ITProGuru Hands-On-Labs

Also of Interest:

This entry was posted in Step-By-Step and tagged , , , , , , by Dan Stolts ITProGuru. Bookmark the permalink.

About Dan Stolts ITProGuru

Dan Stolts (The "ITProGuru") is a technology expert who is a master of systems management and security. He is proficient in many Microsoft products especially in the server area (Windows Server, System Center, Exchange, SharePoint, Virtualization, Etc) and holds many certifications including MCT, MCITP, MCSE, TS, etc. Dan is currently specializing in System Management and Security and is also very passionate about virtualization technologies. Dan is and has been a very active member of the community. He is president of Boston User Groups, Founder of Virtualization Group Boston, Founder of North East Leaders and serves on many IT Community group boards. He is in the process of writing his first book on building technology communities. He is a believer in social networking and can be reached on twitter @ITProGuru. He has participated in many non-technology community groups such as: Rotary Club, Lions Club, local Chambers of Commerce and is a mentor for the local high schools. Dan is an enthusiastic advocate of technology and is passionate about helping others. Dan's lifelong passion has been and continues to be to help and teach others!

3 thoughts on “Hyper-V Replica Step-By-Step #VirtExpert Virtualization Experts (Series Part 22)

  1. Hi there. Finally experimenting with Hyper-V 3 and replication. Do you know if you can replicate from a HA Cluster at your primary data center to a NON clustered environment for DR? We have a 3 node HyperV cluster using iSCSI CSVs for production. I’d like to be able to replicate a subset if individual VMs to a DR site.. probably to a single server with internal storage to save on costs. Can HA/Clustered VMs be replicated to be non-HA on a non HA environment? Thanks