The best management options for your Hyper-V Replica servers

There are various ways to manage Hyper-V Replica configuration, but Hyper-V Manager GUI and Hyper-V Replica PowerShell cmdlets are two top choices.

Hyper-V Replica is a disaster recovery technology designed to replicate virtualized workloads to Hyper-V Servers, called replica servers, running on a disaster recovery site. Hyper-V Replica requires that you enable one Hyper-V Server as a replica server and configure at least one virtual machine to participate in the replication.

The virtual machine (VM) that participates in the replication is called the primary virtual machine and runs on Hyper-V primary server. A copy of the primary VM is replicated to the replica server, called the replica virtual machine. There are various ways to manage Hyper-V Replica configuration, including Hyper-V Manager GUI, Hyper-V PowerShell modules, Hyper-V Replica APIs and RSAT (Remote Server Administration Tools) on a remote computer. An IT administrator can use one of the methods to manage the Hyper-V Replica environment, but the most common methods are using Microsoft's Hyper-V Manager GUI and Hyper-V Replica PowerShell cmdlets.

Using Hyper-V Manager GUI

You can manage replication settings for Hyper-V Server and VMs using Hyper-V Manager GUI.

To check and manage replication settings for a Hyper-V Server, open Hyper-V Server settings, and then click on Replication Configuration in the left pane (see Figure 1).

Replication ConfigurationFigure 1. Open the Replication Configuration inside of your Hyper-V Server settings.

Checking the "Enable this computer as a replica server” setting configures the local Hyper-V server as a replica server. If you need to enable this setting using PowerShell commands, use Hyper-V Replica PowerShell modules. The following PowerShell command configures a Hyper-V Server named Hyper-VServer1 as a replica server:

Invoke-Command -ComputerName Hyper-VServer1 –ScriptBlock {Enable-Netfirewallrule -DisplayName "Hyper-V Replica HTTP Listener (TCP-In)" Set-VMReplicationServer -ReplicationEnabled $true `-AllowedAuthenticationType Kerberos ` -KerberosAuthenticationPort 10000 ` -DefaultStorageLocation "E:\vm" ` -ReplicationAllowedFromAnyServer $true}

This PowerShell command not only enables Hyper-V replication for a Hyper-V Server, but it also opens the required Windows Firewall rules.

PowerShell commands are helpful if you need to configure multiple Hyper-V Servers as replica servers as listed in the command below:

Invoke-Command -ComputerName Hyper-VServer1,Hyper-VServer2,Hyper-VServer3 –ScriptBlock {Enable-Netfirewallrule -DisplayName "Hyper-V Replica HTTP Listener (TCP-In)" Set-VMReplicationServer -ReplicationEnabled $true `-AllowedAuthenticationType Kerberos ` -KerberosAuthenticationPort 10000 ` -DefaultStorageLocation "D:\vm" ` -ReplicationAllowedFromAnyServer $true}

This command configures Hyper-VServer1, Hyper-VServer2 and Hyper-VServer3 as replica servers and enables required Windows Firewall rules to ensure replication takes place. If you need to get replication settings for a Hyper-V Server, use Get-VMReplicationServer PowerShell cmdlet.

To enable replication for a VM running on a primary server, you can either use Hyper-V Manager GUI or PowerShell commands. To configure a VM to participate in the replication, right click on the VM and then click on Enable Replication action as shown in the below screenshot:

Enable Replication Figure 2. Choose Enable Replication after right clicking on the VM.

If you need to enable replication for VM using PowerShell cmdlet, use this PowerShell command:

Invoke-Command -ComputerName Hyper-VServerPR –ScriptBlock {Enable-VMReplication -VMName "MyVM2" ` -ReplicaServerName "Hyper-VServer1.domain.com" ` -ReplicaServerPort 10000 -AuthenticationType Kerberos ` -CompressionEnabled $true -RecoveryHistory 5 }

This enables replication for the virtual machine named MyVM2 and replicates with replica server called Hyper-VServer1.domain.com.

Using Hyper-V PowerShell modules

Hyper-V Replica management is tightly integrated with PowerShell. There are more than 164 Hyper-V PowerShell modules available with Windows Server 2012 to manage Hyper-V and VMs. Out of 164, 16 PowerShell cmdlets are available to manage Hyper-V Replica configuration.

To see the list of Hyper-V modules that apply to Hyper-V Replica, type Show-Command in the PowerShell Window and then type VMReplication to list all the PowerShell modules which are associated with the Hyper-V Replica as shown in Figure 3.

VMReplicationFigure 3. Enter the command VMReplication in the “Name” field

We have already seen an example of the Enable-VMReplication PowerShell cmdlet in an earlier example. Get-VMReplication cmdlet allows you to get replication settings for all VMs enabled for replication.

To get replication settings for a particular VM, use the Get-VMReplication VMName cmdlet. To get replication settings for all VM replicating to a particular replica server, use Get-VMReplication –ReplicaServerName ReplicaServerName.domain.com.

If you need replication statistics and information associated with a VM, use the Measure-VMReplication PowerShell cmdlet.

The Test-VMReplicationConnection PowerShell cmdlet, as the name suggests, allows you to test the replication between a primary and a replica server. The command to test replication between two servers is as follows:

Test-VMReplicationConnection Hyper-VServer1.domain.com 80 Kerberos

Using Failover Cluster Manager UI

When primary or replica servers are part of a Hyper-V failover cluster, all the management for the primary and replica VMs and the Hyper-V Replica configurations must be done from the Failover Cluster Manager UI. This is required in order to receive and manage the cluster-specific functions by the Failover Cluster for VM resources.

Using RSAT

The Hyper-V Manager GUI is included as part of the Remote Server Administration Tools that can be installed on operating systems that support Windows 8, allowing virtual administrators to remotely manage VM replication settings. RSAT is helpful when you need to manage Hyper-V Replica settings on a Server Core Operating System. You can download RSAT from Microsoft’s website.

There are multiple options available to manage Hyper-V Replica settings for Hyper-V Servers and VMs participating in the replication. Most virtual administrators like to use built-in tools (Hyper-V Manager GUI and PowerShell cmdlets) to manage a Hyper-V Replica environment. Third-party vendors can use Hyper-V Replica APIs to develop replication management software, and RSAT helps administrators manage Hyper-V Replica configured on a Server Core Operating System.

This was first published in June 2014

Dig deeper on Microsoft Hyper-V management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Related Discussions

Nirmal Sharma asks:

Which option do you use for configuring Hyper-V Replica servers? And why?

0  Responses So Far

Join the Discussion

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close