Hyper-V Replica helps in achieving availability of VMs. You keep virtual workloads running on Hyper-V hosts in...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
the production site and replicate the same workloads to Hyper-V hosts running in disaster recovery sites. If any disaster strikes at the production site, virtual workloads at disaster recovery sites will be brought online to provide services. While you can enable Hyper-V Replica using Hyper-V Manager or System Center Virtual Machine Manager, I find it more quick and efficient to use PowerShell. Here are the PowerShell commands you need to run in order to manage Hyper-V replication.
Note that you will need at least two Hyper-V hosts running Windows Server 2012 or later in order to configure Hyper-V replication. Hyper-V hosts running in a production site will be known as primary servers and Hyper-V hosts in a disaster recovery site will be known as replica servers.
First, run the command shown below on the replica server in order to enable Hyper-V Replica:
Enable-Netfirewallrule -DisplayName "Hyper-V Replica HTTP Listener (TCP-In)" Set-VMReplicationServer -ReplicationEnabled $true “-AllowedAuthenticationType Kerberos” -KerberosAuthenticationPort 10000 “-DefaultStorageLocation "D:\ReplicatedVMs" “ -ReplicationAllowedFromAnyServer $true
This command configures Hyper-V replication on the replica server and also enables required firewall rules to accept replication from the primary server.
Next, execute the following command on the primary server to enable Hyper-V replication for a particular VM:
Enable-VMReplication -VMName "SQLVM" ` -ReplicaServerName "ReplicaServer.TechTarget.Com" ` -ReplicaServerPort 10000 -AuthenticationType Kerberos ` -CompressionEnabled $true -RecoveryHistory 5
This command enables replication for a VM named SQLVM. The VM is configured to replicate its contents with the replica server. Note that, as part of the command, we are also enabling compression and the recovery history is set to 5.
Finally, you will be required to initiate the replication of SQLVM, so the contents are replicated to the replica server, as shown in the command below:
Start-VMInitialReplication –VMName SQLVM
Once the contents of SQLVM are replicated to the replica server, SQLVM at the replica server will be turned off and SQLVM at the primary server will be running to provide required services. To get the replication status for SQLVM, what you can do is execute Measure-VMReplication on the primary server as shown in the following command:
Speed up the Hyper-V replication process
Learn about Windows Server 2016 Storage Replica
Decide between Hyper-V replication and Storage Replica
Dig Deeper on Microsoft Hyper-V management
Related Q&A from Nirmal Sharma
A misconfigured SCVMM service template can cause serious headaches. Before deploying service templates in production, validate them with SCVMM ...continue reading
When our Run As account experiences issues, SCVMM doesn't show an error message. How do I check account credentials to ensure they're correct?continue reading
It's getting difficult to keep track of all the service templates in SCVMM. Is there a simple command that enables us to query and export them easily?continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.