Help Center/ Distributed Cache Service/ FAQs/ Feature/ What Are Shard and Replica Quantities?
Updated on 2024-10-31 GMT+08:00

What Are Shard and Replica Quantities?

Shard

A shard is a management unit in Redis clusters. Each shard corresponds to a redis-server process. A cluster consists of multiple shards. Each shard has multiple slots. Data is distributively stored in the slots. Shards increase cache capacity and concurrent connections.

Each cluster instance consists of multiple shards. By default, each shard is a master/standby instance with two replicas. The number of shards is equal to the number of master nodes in a cluster instance.

Replica

A replica refers to a node of a DCS instance. It can be a master node or a standby node. A single-replica instance has no standby node. A two-replica instance has one master node and one standby node. For example, if the number of replicas is set to three for a master/standby instance, the instance has one master node and two standby nodes.

Number of Replicas and Shards of Different Instance Types

  • Single-node: Each instance has only one node (one Redis process). If the Redis process is faulty, DCS starts a new Redis process for the instance.
  • Master/Standby or read/write splitting:Each instance has one shard. Each shard has one master node, and one or more standby nodes. If a master node is faulty, a master/standby switchover will be performed to restore the service.
  • Cluster: Each instance has multiple shards. By default, each shard is a master/standby instance with two replicas. For example, if a cluster instance has three shards and two replicas, each shard has two nodes (one master node and one standby node).

    Instance Type

    Shards

    Replicas

    Load Balancing

    IP Addresses

    Single-node

    1

    1 (only)

    -

    1

    Master/Standby

    1

    There are 2 replicas by default. Range: 2–10

    Master/Standby professional edition instances support only 2 replicas.

    Not supported

    Same as the number of replicas

    Read/write splitting

    1

    Default: 2; max.: 6

    Supported

    1

    Proxy Cluster

    Multiple

    2 (not customizable)

    Supported

    1

    Redis Cluster

    Multiple

    There are 2 replicas by default. Range: 1–5

    Not supported

    Number of replicas x Number of shards