Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Configuring Hyper-V Replica on Azure – PART 2

  • December 4, 2018
  • 10 min read
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.

HyperV

Introduction

In order to replicate your Hyper-V Virtual Machines between two hosts, the replication process must copy the snapshot from the primary host to the secondary host. Why using the Hyper-V Replica? This allows you to run a standby server with copies of the VMs ready in case of business continuity and disaster recovery.

As a reminder, I use the following architecture in this article:

Azure

In the first part, I deployed two Hyper-V hosts:

  • The first one is called “Hypv-Europe“, which is located in the Resource Group 1
  • and the second one is called “Hypv-France“, which is located in the Resource Group 2.

Virtual Network Peering is enabled to allow the communication between “Hypv-Europe” and “Hypv-France“.

Configuring Hyper-V Replication

Before configuring the Hyper-V replication, you must have a valid Virtual Machine to replicate from the primary host to secondary host. In my case, on the primary host “Hypv-Europe”, I created a Virtual Machine called “Ubuntu1804_LTS” that will be replicated on “Hypv-France”:

wp-image-10453

We must enable replication on the primary host and the replica host. Open the Hyper-V console, right-click on your Hyper-V host, and select “Hyper-V Settings…

wp-image-10454

1. Click “Replication Configuration” in the left pane

2. Turn on Checkbox to “Enable this computer as a Replica server

3. Make sure “Use certificate-based Authentication (HTTPS)” and specify the port: 443

4. Click “Allow replication from any authenticated server“. Here, you can enter the IP Address of the second Hyper-V Host to allow only this host to replicate VMs to this host.

5. Specify the default location you would like to store replicas

6. To finish, click “Apply” and “OK

Repeat these steps for the second host.

wp-image-10455

To allow any incoming virtual machine replication traffic for configured replication ports, you must ensure an inbound firewall rule is created. Open the Windows Firewall blade, right-click the following rules and select “Enable Rule“:

wp-image-10456

Configuring Hyper-V Host Certificates

In this lab, I do not use an Active Directory Domain, so both Hyper-V host are in a workgroup. I need to use a certificate to allow replication. So, the first step we need to do is to create a root CA certificate.

Go to the first host and run the following command:

Next, we must create two server certificates for both Hyper-V hosts. We will use the previous Thumbprint and run the following command:

Do not forget to replace the subject parameter to match with Hyper-V Hostnames. The output should be similar to the following:

wp-image-10457

If it works as expected, you should have three certificates in the Certificates store. Open the MMC for the local computer and confirm that certificates are visible:

wp-image-10458

Next, right-click each certificate and select “Export”. Do not forget to include the private key.

wp-image-10459

We need to import these certificates to the second Hyper-V host. Import the root CA certificate to the “Trust Root Certification Authorities” store and import both Hyper-V host certificates to the “Personal” Store.

Go back to the Replication Settings on both Hyper-V hosts and select the certificate:

wp-image-10460

You should have something like the following screenshot:

wp-image-10461

wp-image-10462

Please note that if the console cannot find the certificate, then you must close the Hyper-V Manager console to refresh the store.

Enabling Replication

Everything is ready to replicate the Virtual Machine. Go to the Hyper-V Manager Console, right-click the Ubuntu Virtual Machine, and choose “Enable Replica”.

wp-image-10463

Enter the name of the second Hyper-V Host. In my case, I want to replicate the Virtual Machine from “Hypv-Europe” to “Hypv-France“:

wp-image-10464

Select the second option to use HTTPS and select the certificate

wp-image-10465

Use the default settings or change some settings to suit your needs.

wp-image-10466

Choose when the changes will be sent to the replica server.

wp-image-10467

Select how many recovery points you want to maintain.

wp-image-10468

Select the first option to send the initial copy over the network.

wp-image-10469

wp-image-10470

Click “Finish” to start the replication process from the primary host to the secondary host.

wp-image-10471

In my case, the VM is very light, so the replication has been done very quickly. You can check some information such as the replication health. Right-click on the Source and Replica Virtual Machine, and select “View Replication Health…”

wp-image-10472

Confirm the following replication information:

  • Current primary server
  • Current replica server
  • Replication health
  • Errors encountered

wp-image-10473

 

Conclusion

Thanks to this guide, you should be able to create your own Hyper-V lab on Azure. Obviously, you should not use this topology in a production environment because Microsoft does not support this type of installation. However, it can be useful to test the Hyper-V features using this architecture, especially if you do not have your own lab at home.

Thanks for reading!

Found Nicolas’s article helpful? Looking for a reliable, high-performance, and cost-effective shared storage solution for your production cluster?
Dmytro Malynka
Dmytro Malynka StarWind Virtual SAN Product Manager
We’ve got you covered! StarWind Virtual SAN (VSAN) is specifically designed to provide highly-available shared storage for Hyper-V, vSphere, and KVM clusters. With StarWind VSAN, simplicity is key: utilize the local disks of your hypervisor hosts and create shared HA storage for your VMs. Interested in learning more? Book a short StarWind VSAN demo now and see it in action!