Share via


Step-By-Step: Virtual Machine Replication Using Hyper-V Replica

As mentioned in previous posts, now that #CANITPRO Camp V2 is in play, labs from version 1 are being converted into Step-By-Step posts to be provided as a resource to IT Professionals. One of the labs conducted in version 1 of the camps was Virtual Machine replication using Hyper-V Replica.

 

 

New to Windows Server 2012, Hyper-V Replica is an asynchronous, virtual machine replication technology designed for business continuity and disaster recovery. With Hyper-V Replica, one can replicate a virtual machine from one location to another simple utilizing Hyper-V and a network connection. Hyper-V Replica works with any server network and/or storage vendor and provides unlimited replication capability out of the box.

Benefits achieved by to your organization include:

  • 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.

 

Hyper-V Replica can be utilized on hardware certified for Windows Server 2012. The following prerequisites are required to take advantage of Hyper-V Replica included as part of the Hyper-V server role

  • 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.

 

Prerequisite

Enabling Replication on the Replica Server

 

 

 

 

  1. In Server Manager, click Tools, and then click Hyper-V Manager.
  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
  11. Click OK

Note: Replica Server Authorization

After deciding authentication types, specification of which primary servers are permitted to replicate virtual machines to your Replica server is required. Authorization can be allowed from any authenticated server, or a specified primary server. Hyper-V Replica allows the option to designate a specific location to store your recovery virtual machine files in either case via a SAN, SMB file server, or using direct-attached storage.

Note: 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.

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.

  1. Start – type: Control Panel

  2. Click Control Panel > System and Security > Windows Firewall > Advanced Settings > Inbound Rules

  3. Hyper-V Replica HTTP Listener (TCP-In)Right Click and Select Enable Rule (make sure the rule is enabled for the proper network)

  4. Hyper-V Replica HTTPS Listener (TCP-In)Right Click and Select Enable Rule (make sure the rule is enabled for the proper network)

  5. Close Windows Firewall with Advanced Security

 

Initial Virtual Machine Replication

An initial copy of all your virtual hard disks (VHDs) must be transferred to the Replica server (at your Replica site) before using Hyper-V Replica.

  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 then Click Next

  6. Replica Server Authentication – After Replica server for virtual machine replication is enabled, configuration of specific authentication types and ports for incoming replication traffic is required.

    Two authentication options are available. Kerberos authentication (using HTTP), which does not allow the data you send across the network will not be encrypted or certificate-based authentication (using HTTPS), which does encrypt the data sent across the network.

  7. Chose Recovery History options as desired (ex. Additional Recover Points = 4, Replicate incremental VSS every 4 hours)

    Recovery points contain one or more snapshots. The options presented allow for keeping the latest recovery point for restoring your primary virtual machine on the Replica server, or allow the ability to maintain multiple recovery points on your server. When choosing the multiple recovery points option, remember that more storage would be required on the Replica server. Additionally, when specification at to the number of recovery points is utilized, 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.

  8. Click Send initial copy over the network and Start replication immediately then Click Next

  9. Turn on the drives you want to replicate then Click Finish

 

Hyper-V Replica Failover Operations

Hyper-V Replica is designed to help both planned (scheduled events) and unplanned (disaster recovery) failover situations. Hyper-V Replica allows for 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.

 

  • 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.

  • 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.

Be sure to test in lab Virtual Machine Replication Using Hyper-V Replica for yourself by downloading Windows Server 2012, and Hyper-v Server 2012.

Comments

  • Anonymous
    April 09, 2013
    Thank you for the great presentation

  • Anonymous
    April 17, 2013
    Great post! But what about the ip settings will them also be transferred? How my clients on the primary site will access the virtual server on the replica site in case it fails?

  • Anonymous
    April 19, 2013
    Egberto - Hyper-V Manager provides the ability to configure the IP address that the Replica virtual machine should use in the event of failover.

  • Anonymous
    April 20, 2013
    Thank you

  • Anonymous
    September 22, 2016
    Excellent, concise and complete tutorial on Hyper-V replication. Also realized how easy Microsoft makes it. Thanks for putting it together.

  • Anonymous
    November 28, 2016
    Thanks for posting this article, really explained very well, understand in first reading.

  • Anonymous
    December 10, 2016
    Thank you excellent

  • Anonymous
    February 13, 2017
    Under section 5 on replica server name .canitpro.net mention there. How to create or include as my configuration always comes as default with only serve er name any suggestions or solution due to which hyperv configuration keeps failure.

  • Anonymous
    February 13, 2017
    Thank for post. I need some idea about the section 5 ,server name mentioned with some .canitpro. net how to add in server my computer it comessage with only server name as it keep on failing in replica configuration any suggestions or solution?