Enable VM Replication

Enable VM Replication on Hyper-V server will allows you to replicate a Virtual Machine from one of Hyper-V server to another Hyper-V server. There are some advantages by enabling the VM replication such as:

  • In the event of failure to Primary Server (for example, Server failure, Power Outage or Datacenter Failure) you can easily to failed over your production Server to the Replica server with minimal downtime.
  • Since the storage doesn’t need to be identical between Primary Server and Replica Server, you don’t need to have a domain controller to enable VM replication.

Enabling Hyper-V Replication on Replica Server

Before you continue, you need to enable the Replica Server to be allowed to receive the VM Replication from the Primary Server.

Enable VM Replication
Enable VM Replication
  1. Open Hyper-V Manager for the Replica Server.
  2. Click Hyper-V Setting on the Right Panel. It will open a Hyper-V Server Configuration as the image above.
  3. Click Replication Configuration (left panel).
  4. Turn on Checkbox to “Enable this computer as a Replica server”.
  5. Make sure Use Kerberos (HTTP): is checked to Specify the port: 80.
  6. Click Allow replication from any authenticated server.
  7. Type the location you would like to put replicas.
  8. Click OK.

Or you can use PowerShell Command as below:

Set-VMReplicationServer -ComputerName hyperv-01 -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $true  
-DefaultStorageLocation F:\VMs

Firewall Configuration for Hyper-V replication

If you enable the Windows Firewall, you need to configured the Windows Firewall to allow the Hyper-V Replication to work properly. Below the steps to configure the Windows Firewall for Hyper-V Replication.

  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

Enable VM Replication

Using Hyper-V Manager

On the Hyper-V Manager, select the VM you want to replicate and right click on the VM and select Enable Replication.

Enable Replication
Enable replication

Specify the Replica Server.

Replica Server
Replica Server

Specify the connection parameters or if you want to compress the data transmitted.

Connection Configuration
Connection Configuration

Select which VM’s Disks (VHDX) you want to replicate.

VM VHDX
VM Disks

Select Frequency changes will be sent to replica server. You can select 1 minute, 5 minutes or 15 minutes.

Frequency Changes
Frequency Changes

Select which recovery point you want to set.

VMReplication Recovery Point
VMReplication Recovery Point

Select how the Initial VM Replication Method configured.

VM Replication Initial Method
VM Replication Initial Method

Using PowerShell Command

You can use the PowerShell command to enable the VM Replication. Below the example command to Enable the VM Replication.

Enable-VMReplication -VMName '2003' -ReplicaServerName 'hyperv-01.test.com' -ReplicaServerPort 80 -AuthenticationType Kerberos -CompressionEnabled $true Set-VMReplication -VMName '2003' -ReplicaServerName 'hyperv-01.msnoob.com' -ReplicaServerPort 80 -AuthenticationType Kerberos -CompressionEnabled $true -RecoveryHistory 0 

Start-VMInitialReplication -VMName '2003'

If you want to Enable Replica for all VMs, you can use the command below:

Enable-VMReplication * hyperv-01.msnoob.com 80 Kerberos

If you like this article, please share, subscribe or you can follow our Facebook Page and Twitter.