Setting Hyper-V Replica

Posted: December 24, 2016 in Windows Server

Hyper-V replica feaytures replicates virtual machines from one Hyper-V host server to another. Hyper-V Replica creates a copy of a live virtual machine to a replica offline virtual machine.It’s part of failover strategy.For example,if we have 2 datacenters,we can replicate VM from one data center to another.Replicated VM is in offline state,so in case of disaster recovery VM can be powered on to continue services.This an be used in clustered and non-clustered configuration.

In this example we’ll replicate VM from HyperV-02 to HyperV-01 Hyper-V host:

Enabling replication

First,on HyperV-01 host enable replication from HyperV-02:

On HyperV-01 go to Hyper-V settings

1-1.png

Set Kerberos authentication

1.PNG

PowerShell:

Set-VMReplicationServer -ComputerName hyperv-01 -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $false

Because we want to allow replication only from specific server we need to add ReplicationAutorization Entry (trust group is random chosen)

New-VMReplicationAuthorizationEntry -AllowedPrimaryServer hyperv-02.test.com -ReplicaStorageLocation  c:\vm -TrustGroup test_group

Setting firewall:

Rule for Hyper-V replication is turned off by default,we need to enable it:

3.png

Get-NetFirewallRule -displayName ‘Hyper-V Replica HTTP Listener (TCP-In)’ | Enable-NetFirewallRule

On HyperV-02 host (where VM is located)

1.PNG

Set-VMReplicationServer -ComputerName hyperv-02 -ReplicationEnabled $true -AllowedAuthenticationType Kerberos -ReplicationAllowedFromAnyServer $false
New-VMReplicationAuthorizationEntry -AllowedPrimaryServer hyperv-01 -ReplicaStorageLocation c:\vm -TrustGroup test_group

Enabling replication for VM

On HyperV-02 right click VM-Enable Replication:

1-1.png

Enter Hyper-V host where VM will be replicated:

1-1.png

Choose if you wish to compress the data

1-1.png

If VM has more than one disk,it can be excluded from replication:

1-1.png

Set replication frequency

1-1.png

Configure recovery points:

1-1.png

Choose how VM data can be transferred to Replica Server (HyperV-01),over the network,or export it locally and copy it then to target server,and schedule replication

1-1.png

Using PowerShell:

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

We can track replication status:

Right click VM-Replication-View Replication Health

4.png

 

 

5

 

Get-VMReplication -VMName '2003' | fl *

 

6.PNG

 

Advertisements
Comments
  1. jcpro says:

    Now how do you do this with HTTPS certificate based authentication instead of Kerberos in a remote site – site connection with no existing VPN connecting the two sites?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s