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.
- Open Hyper-V Manager for the Replica Server.
- Click Hyper-V Setting on the Right Panel. It will open a Hyper-V Server Configuration as the image above.
- Click Replication Configuration (left panel).
- Turn on Checkbox to “Enable this computer as a Replica server”.
- Make sure Use Kerberos (HTTP): is checked to Specify the port: 80.
- Click Allow replication from any authenticated server.
- Type the location you would like to put replicas.
- 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
- 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
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.
Specify the Replica Server.
Specify the connection parameters or if you want to compress the data transmitted.
Select which VM’s Disks (VHDX) you want to replicate.
Select Frequency changes will be sent to replica server. You can select 1 minute, 5 minutes or 15 minutes.
Select which recovery point you want to set.
Select how the Initial VM Replication Method configured.
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.
Thank you. Appreciate it.