Configure active geo-replication for Enterprise Azure Cache for Redis instances

In this article, you learn how to configure an active geo-replicated cache using the Azure portal.

Active geo-replication groups up to five instances of Enterprise Azure Cache for Redis into a single cache that spans across Azure regions. All instances act as the local, primary caches. An application decides which instance or instances to use for read and write requests.

Note

Data transfer between Azure regions is charged at standard bandwidth rates.

Create or join an active geo-replication group

  1. When creating a new Azure Cache for Redis resource, select the Advanced tab. Complete the first part of the form including clustering policy. For more information on choosing Clustering policy, see Clustering Policy.

  2. Select Configure to set up Active geo-replication.

    Screenshot of advanced tab of create new Redis cache page.

  3. Create a new replication group for a first cache instance. Or, select an existing one from the list.

    Screenshot showing replication groups.

  4. Select Configure to finish.

  5. Wait for the first cache to be created successfully. When complete, you see Configured set for Active geo-replication. Repeat the above steps for each cache instance in the geo-replication group.

    Screenshot showing active geo-replication is configured.

Remove from an active geo-replication group

To remove a cache instance from an active geo-replication group, you just delete the instance. The remaining instances will reconfigure themselves automatically.

In case one of the caches in your replication group is unavailable due to region outage, you can forcefully remove the unavailable cache from the replication group.

You should remove the unavailable cache because the remaining caches in the replication group start storing the metadata that hasn’t been shared to the unavailable cache. When this happens, the available caches in your replication group might run out of memory.

  1. Go to Azure portal and select one of the caches in the replication group that is still available.

  2. Select to Active geo-replication in the Resource menu on the left to see the settings in the working pane.

    Screenshot of active geo-replication group.

  3. Select the cache that you need to force-unlink by checking the box.

  4. Select Force unlink and then OK to confirm.

    Screenshot of unlinking in active geo-replication.

  5. Once the affected region's availability is restored, you need to delete the affected cache, and recreate it to add it back to your replication group.

Set up active geo-replication using the Azure CLI or PowerShell

Azure CLI

Use the Azure CLI for creating a new cache and geo-replication group, or to add a new cache to an existing geo-replication group. For more information, see az redisenterprise create.

Create new Enterprise instance in a new geo-replication group using Azure CLI

This example creates a new Azure Cache for Redis Enterprise E10 cache instance called Cache1 in the East US region. Then, the cache is added to a new active geo-replication group called replicationGroup:

az redisenterprise create --location "East US" --cluster-name "Cache1" --sku "Enterprise_E10" --resource-group "myResourceGroup" --group-nickname "replicationGroup" --linked-databases id="/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache1/databases/default"

To configure active geo-replication properly, the ID of the cache instance being created must be added with the --linked-databases parameter. The ID is in the format:

/subscriptions/<your-subscription-ID>/resourceGroups/<your-resource-group-name>/providers/Microsoft.Cache/redisEnterprise/<your-cache-name>/databases/default

Create new Enterprise instance in an existing geo-replication group using Azure CLI

This example creates a new Cache for Redis Enterprise E10 instance called Cache2 in the West US region. Then, the cache is added to the replicationGroup active geo-replication group created above. This way, it's linked in an active-active configuration with Cache1.

az redisenterprise create --location "West US" --cluster-name "Cache2" --sku "Enterprise_E10" --resource-group "myResourceGroup" --group-nickname "replicationGroup" --linked-databases id="/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache1/databases/default" --linked-databases id="/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache2/databases/default"

As before, you need to list both Cache1 and Cache2 using the --linked-databases parameter.

Azure PowerShell

Use Azure PowerShell to create a new cache and geo-replication group, or to add a new cache to an existing geo-replication group. For more information, see New-AzRedisEnterpriseCache.

Create new Enterprise instance in a new geo-replication group using PowerShell

This example creates a new Azure Cache for Redis Enterprise E10 cache instance called "Cache1" in the East US region. Then, the cache is added to a new active geo-replication group called replicationGroup:

New-AzRedisEnterpriseCache -Name "Cache1" -ResourceGroupName "myResourceGroup" -Location "East US" -Sku "Enterprise_E10" -GroupNickname "replicationGroup" -LinkedDatabase '{id:"/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache1/databases/default"}'

To configure active geo-replication properly, the ID of the cache instance being created must be added with the -LinkedDatabase parameter. The ID is in the format:

/subscriptions/<your-subscription-ID>/resourceGroups/<your-resource-group-name>/providers/Microsoft.Cache/redisEnterprise/<your-cache-name>/databases/default

Create new Enterprise instance in an existing geo-replication group using PowerShell

This example creates a new Azure Cache for Redis E10 instance called Cache2 in the West US region. Then, the cache is added to the "replicationGroup" active geo-replication group created above. This way, it's linked in an active-active configuration with Cache1.

New-AzRedisEnterpriseCache -Name "Cache2" -ResourceGroupName "myResourceGroup" -Location "West US" -Sku "Enterprise_E10" -GroupNickname "replicationGroup" -LinkedDatabase '{id:"/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache1/databases/default"}', '{id:"/subscriptions/34b6ecbd-ab5c-4768-b0b8-bf587aba80f6/resourceGroups/myResourceGroup/providers/Microsoft.Cache/redisEnterprise/Cache2/databases/default"}'

As before, you need to list both Cache1 and Cache2 using the -LinkedDatabase parameter.

Next steps

Learn more about Azure Cache for Redis features.