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.
Enabling Replication on the Replica Server
- In Server Manager, click Tools, and then click Hyper-V Manager.
- 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)
- Click Hyper-V Manager.
- Click ServerName.
- Click Hyper-V Settings(right pane)
- Click Replication Configuration(left pane)
- Turn on Checkbox to “Enable this computer as a Replica server”
- Make sure Use Kerberos (HTTP): is checked Specify the port: 80
- Click Allow replication from any authenticated server
- Type the location you would like to put replicas
- 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.
- Start – type: Control Panel
- Click Control Panel > System and Security > Windows Firewall > Advanced Settings > Inbound Rules
- Hyper-V Replica HTTP Listener (TCP-In) – Right Click and Select Enable Rule (make sure the rule is enabled for the proper network)
- Hyper-V Replica HTTPS Listener (TCP-In) – Right Click and Select Enable Rule (make sure the rule is enabled for the proper network)
- 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.
- In Hyper-V Manager, Select the Virtual Machine you wish to replicate
- In Task Pane (right Pane) select Enable Replication (this is also available on the right click menu)
- Click Next on Before You Begin
- Type or Browse to the Replica Server (remember, this is the name of the destination server that will receive the replica) then Click Next
- Make sure Compress the data that is transmitted over the network is turned ON then Click Next
- 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.
- 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.
Click Send initial copy over the network and Start replication immediately then Click Next
- 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.