Displaying present location in the site.

We Tried Building an HA Cluster Across Regions Using Virtual Network Peering on Azure (Windows/Linux)

EXPRESSCLUSTER Official Blog

March 28th, 2022

Machine translation is used partially for this article. See the Japanese version for the original article.

Introduction

We tried building an HA cluster across regions on Microsoft Azure (hereinafter called “Azure”).

In Azure, virtual network peering allows you to interconnect networks between Azure virtual network (hereinafter called “Virtual network”), allowing you to build HA clusters with diverse network configurations.

This time, we will introduce the procedure for building an HA cluster across regions using virtual network peering.

Contents

1. What is Virtual Network Peering?

Virtual network peering is a function that interconnects virtual networks.

There are two types of virtual network peering:

  • Virtual network peering
    Connect virtual networks within the same region.
  • Global virtual network peering
    Connect virtual networks across regions.

The peered virtual networks function apparently as a single network.
Resources in one virtual network can connect directly to resources in the other virtual network.
Traffic between virtual machines is routed directly through Microsoft's private network, not through gateways or the public Internet.

2. HA Cluster Configurations

This time, we will build a two-node mirror disk type cluster using Azure DNS.
Azure Virtual Machines (hereinafter called "VM") is located in the West Central US region and the West US 2 regions, respectively, and connects virtual networks in the West Central US region and the West US 2 regions using global virtual network peering.

The configuration is as follows.
Use the Azure DNS to switch destinations to active VMs.

Configuration

3. HA Cluster Building Procedure

We build an "HA cluster using Azure DNS".
The configuration of the networks and VMs is as follows.

  • Settings of Resource group
  • Name
  • TestGroup1
  • Region for Resource group
  • West Central US
  • Settings of DNS zone
  • Name
  • test.zone
  • Record set
  • sample

  • West Central US Region
  • Settings of Virtual network
  • Name
  • Vnet1
  • Address space
  • 10.5.0.0/24
  • Subnet name
  • Vnet1-1
  • Subnet address range
  • 10.5.0.0/24
  • Settings of VM
  • ■Hostname
  • Server 1 (active VM) : Server01
  • Settings of NIC
  • NIC - IP configuration
  • ipconfig1 (primary): 10.5.0.120

  • West US 2 Region
  • Settings of Virtual network
  • Name
  • Vnet2
  • Address space
  • 10.6.0.0/24
  • Subnet name
  • Vnet2-1
  • Subnet address range
  • 10.6.0.0/24
  • Settings of VM
  • ■Hostname
  • Server 2 (standby VM) : Server02
  • Settings of NIC
  • NIC - IP configuration
  • ipconfig1 (primary): 10.6.0.120

3.1 Creating HA Clusters Using Azure DNS

For procedure on building an HA cluster, refer to "4 Cluster Creation Procedure (for an HA Cluster Using Azure DNS)" in the "HA Cluster Configuration Guide for Microsoft Azure".
Referring to the procedure for building an HA cluster, after creating the VMs, install the Azure CLI, create the service principal, and configure EXPRESSCLUSTER X.

[Reference]
  • Windows > Cloud > Microsoft Azure > EXPRESSCLUSTER X 4.3 HA Cluster Configuration Guide for Microsoft Azure (Windows)

  • 4. Cluster Creation Procedure (for an HA Cluster Using Azure DNS)

  • Linux > Cloud > Microsoft Azure > EXPRESSCLUSTER X 4.3 HA Cluster Configuration Guide for Microsoft Azure (Linux)

  • 4. Cluster Creation Procedure (for an HA Cluster Using Azure DNS)

Since "4.2 Configuring Microsoft Azure - 2) Creating a virtual network" in the HA Cluster Configuration Guide is a procedure for deploying VMs in the same region, only the virtual network "Vnet1" is created.
This time, in order to place the VM in another region and build a mirror disk type HA cluster, create virtual networks "Vnet1" and "Vnet2".
Also, in "4.2 Configuring Microsoft Azure - 3) Creating a virtual machine" in the HA Cluster Configuration Guide, select the [Region] where the VM will be placed, and place the VM in a different virtual network.
Create virtual machine "Server01" in the "West Central US" region and virtual machine "Server02" in the "West US 2" region.

After creating the virtual networks "Vnet1" and "Vnet2", it is necessary to interconnect the networks, so please refer to this blog "3.2 Creating Virtual Network Peering" to configure virtual network peering.

3.2 Creating Virtual Network Peering

Use the Azure portal to connect virtual networks with virtual network peering.
After creating the virtual networks "Vnet1" and "Vnet2", select the virtual network "Vnet1".
After selecting "Vnet1", select [Peerings] in [Settings] on the left menu, and then click [Add].

Virtual network peering-1

Enter or select the following information. Leave the other settings at their default values and click [OK].

  • This virtual network - Peering link name
  • Remote virtual network - Peering link name
  • Virtual network

The procedure for the virtual network connection was refered to the following site.

4. Checking the Operation

Checking the operation by referring to "4 Cluster Creation Procedure (for an HA Cluster Using Azure DNS) - 4.4 Verifying the created environment" in the "HA Cluster Configuration Guide for Microsoft Azure".

[Reference]
  • Windows > Cloud > Microsoft Azure > EXPRESSCLUSTER X 4.3 HA Cluster Configuration Guide for Microsoft Azure (Windows)

  • 4. Cluster Creation Procedure (for an HA Cluster Using Azure DNS)
  • 4.4 Verifying the created environment

  • Linux > Cloud > Microsoft Azure > EXPRESSCLUSTER X 4.3 HA Cluster Configuration Guide for Microsoft Azure (Linux)

  • 4. Cluster Creation Procedure (for an HA Cluster Using Azure DNS)
  • 4.4 Verifying the created environment

Note the IP address of the DNS server from the result of the nslookup command.

Next, before and after the failover, specify the virtual host name (sample.test.zone in this configuration) as the argument of the ping command and execute it.
Check whether the specified virtual host name has been name resolved as the IP address of the active VM or the standby VM.

Change the DNS server settings referenced by the VM (Client) in advance.

DNS servers

The procedure for change the DNS server was refered to the following site.

[Reference]

After changing the DNS server settings, do the following:

  • 1.Start failover group on Server01.
  • 2.Execute the ping command from Server01 and confirm that the virtual host name has been name resolved as the IP address of Server01.
  • 3.From the Cluster webUI, manually move the failover group from Server01 to Server02.
  • 4.Execute the ping command from Server02 and confirm that the virtual host name has been name resolved as the IP address of Server02.

We have confirmed that we can use Azure DNS resources to access VMs located in different regions with the same virtual host name.

Conclusion

This time, we introduced the procedure for building an HA cluster across regions using virtual network peering.
Virtual network peering is very convenient way to easily interconnect virtual networks even if they are in different regions.

If you consider introducing the configurations described in this article, you can perform a validation with the popuptrial module of EXPRESSCLUSTER. Please do not hesitate to contact us if you have any questions.