Rack-zone awareness helps ensure high availability in the event of a rack or zone failure.

When you enable rack-zone awareness in a Redis Enterprise Software cluster, you assign a rack-zone ID to each node. This ID is used to map the node to a physical rack or logical zone. The cluster can then ensure that master shards, corresponding replica shards, and associated endpoints are placed on nodes in different racks or zones.

In the event of a rack or zone failure, the replicas and endpoints in the remaining racks and zones are promoted. This ensures high availability when a rack or zone fails.

There is no limitation on the number of racks and zones per cluster. Each node can belong to a different rack or multiple nodes can belong to the same rack.

Rack-zone awareness affects various cluster, node, and database actions, such as node rebalancing, node removal, node replacement, shard and endpoint migration, and database failover.

Rack-zone ID rules

The rack-zone ID must comply with the following rules:

  • Maximum length of 63 characters.
  • Characters consist of letters, digits, and hyphens ('-'). Underscores ('_') are also accepted as of Redis Enterprise Software 6.4.2-61.
  • ID starts with a letter and ends with a letter or a digit.
Note:
Rack-zone IDs are case-insensitive (uppercase and lowercase letter are treated as the same).

Node layout guidelines

Avoid placing the majority of nodes in one availability zone.

If a Redis Enterprise Software cluster consists of three nodes (the recommended minimum), follow these guidelines:

  • For high availability, the three nodes must be distributed across three distinct racks or zones.

  • When using availability zones, all three zones should exist within the same region to avoid potential latency issues.

Set up rack-zone awareness

To enable rack-zone awareness, you need to configure it for the cluster, nodes, and databases.

New cluster

You can set up rack-zone awareness for the cluster and its nodes during cluster creation:

  1. In the Cluster screen’s Configuration section, enable Rack zone awareness.

  2. Select Next to continue to the Node configuration screen.

  3. Enter a Rack-zone ID for the current node.

  4. Finish cluster setup.

  5. For every node you add to the cluster, assign a different Rack-zone ID.

Existing cluster

If you did not configure rack-zone awareness during cluster creation, you can configure rack-zone awareness for existing clusters using the REST API:

  1. For each node in the cluster, assign a different rack-zone ID using the REST API to update the node:

    PUT /v1/nodes/<node-ID>
    { "rack_id": "rack-zone-ID" }
    
  2. Update the cluster policy to enable rack-zone awareness:

    PUT /v1/cluster/policy
    { "rack_aware": true }
    

Enable database rack-zone awareness

Before you can enable rack-zone awareness for a database, you must configure rack-zone awareness for the cluster and its nodes. For more information, see set up rack-zone awareness.

To enable rack-zone awareness for a database, use a REST API request:

PUT /v1/bdbs/<database-ID>
{ "rack_aware": true }

Rearrange database shards

After you enable rack-zone awareness for an existing database, you should generate an optimized shard placement blueprint using the REST API and use it to rearrange the shards in different racks or zones.

  1. Generate an optimized shard placement blueprint:

    1. Send the following GET request:

      GET /v1/bdbs/<database-ID>/actions/optimize_shards_placement
      
    2. Copy the cluster-state-id from the response headers.

    3. Copy the JSON response body, which represents the new shard placement blueprint.

  2. Rearrange the database shards according to the new shard placement blueprint:

    1. In the request headers, include the cluster-state-id from the optimize_shards_placement response.

    2. Add the following JSON in the request body and replace <shard placement blueprint> with the new blueprint:

      {
        "shards_blueprint": <shard placement blueprint>
      }
      
    3. Send the following PUT request to rearrange the shards:

      PUT /v1/bdbs/<database-ID>
      

Shard placement without rack-zone awareness

Even if a database has rack-zone awareness turned off, the cluster still ensures that master and replica shards are placed on distinct nodes.