Setting up Redis Active-Active Geo-Distributed Setup(CRDTs-Based) on Azure

Ramindu De Silva
5 min readJan 24, 2023

Redis Enterprise Software provides detailed instructions on setting up an Active_Active cluster on a local machine with documentation.

But, when deploying an actual Geo-Distributed database cluster for CRDT solution, it has to span across multiple regions.

In this article, I will be sharing the configurations that I used to configure the 2 node Active-Active Geo-Distributed Cluster. For this, I have used Azure as the cloud service provider.

Setting up Azure Deployment

Creating Resource Groups

Since we are deploying on two different regions, I have created two resource groups called RedisGroup-EastUS and RedisGroup-EastAsia. You could search on the Azure search bar in order to get the wizard to create resource groups as follows.

Create 2 resources each with the needed regions.

Creating the VMs

When creating VMs (namely redisasia and redisus), make sure to select the resource group so that the VM will be created in the selected region. In the Basics section, Ubuntu server 18.04 with Standard B2s as the size was can be selected. Password or SSH-public-key can be selected as the authentication method. Azureuser as the username can be chosen.

Confirm whether the virtual network is automatically selected as below in the Networking section. It should be aligned with the resource group name.

Review and create the instances.

Note: the public IP addresses in the VMs can be accessed here, since we need those when adding it as records in the DNS zone in the next section.

After creating the VMS, in the networking section in the VMs allow the “53,5353,8001,8070,8443,8080,9443,10000–11999,12001–19999,12000,3340” or simple add * to allow all the ports.

Creating the DNS and Adding Records

Since I chose DNS option (zero-configuration using mdns and no dns options are available too), when configuring the clusters, it requires a FQDN and when the databases are created.

And when the databases are created, prefix will be added to the FQDN. Following is the instructions when clicking on the “Read more” section of the FQDN.

So we need a domain name, cluster name and a prefix and a mechanism to route and communicate with each other. To create a domain using Azure, we could use “Azure DNS” (which also can be found using the search bar) and select the RedisGroup-EastUS as the resource group and name the DNS zone as “rediscrdt.com”.

Using the “Record set”, add the following records to the DNS zone.

In the above picture, the records with the “asia” contains the public IP (which is stroke off with black) address of the “redisasia” VM and records with “us” contains the public IP addresses of the “redisus” VM.

In this scenario, you could see that the prefix is added as redis-12000 since it would be the autogenerated endpoint of the database when the active active databases are created in later stages.

Note:

The name server address is needed to edit the /etc/resolver.conf after installing the Redis on the VM, so that the communication can be happen between each other. This is due to the the DNS zone we created only can be resolved with the above name server.

You could refer to document to make the change permanent.

Installing Redis Enterprise Software on the VMs

To install the software and configure few configs, ssh the instances with the provided key or password

ssh azureuser@ip-address # the password will be prompted afterwards
ssh -i /home/ubuntu/xxxx.pem azureuser@ip-address # .pem should be given chmod 600 for overcome warnings

Once, inside the VM ping the name server address and retrieve its ip address and replace the “nameserver” in /etc/resolv.conf in both VMs as follows

And ping and see whether all following urls are accessible

ping asia.rediscrdt.com
ping us.rediscrdt.com
ping redis-12000.asia.rediscrdt.com
ping redis-12000.us.rediscrdt.com

Downloading Installing the software is straight forward as mentioned in the official documentation of getting started and follow until Step 2: Set up a cluster and provide the relevant FQDN for each server. And DO NOT follow the next steps, since those steps will only create a Single Deployment Database.

Then navigate Step 3: Create a Redis Active-Active database to getting started of active-active database documentation and select “Geo-distributed” deployment and click on Next.

For the participating clusters list, add the address as https://asia.rediscrdt.com:9443 and https://us.rediscrdt.com:9443 and admin credentials for the clusters given when creating each cluster. Rest of the information can be filled as follows.

And if the the deployment is successful, the databases should be created in both clusters (even though we configured in one cluster) and should synced successfully.

Testing

You could simply follow documentation.

I hope this blog will help people to setup the Active-Active Geo-Distributed setup on Azure. Any improvement on the networking configurations are appreciated.

--

--