Help Center> Distributed Cache Service> FAQs> Feature> What Are Shard and Replica Quantities?
Updated on 2023-11-30 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 distributedly 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 and read/write splitting: Each instance has one shard, which contains one master node and one or more standby nodes. If the master node is faulty, master/standby switchover is triggered to restore services. The more the replicas (standby nodes), the better the reliability (performance is unaffected).
  • 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 three replicas, each shard has three nodes (one master node and two standby nodes).

    Instance Type

    Shards

    Replicas

    Load Balancing

    IP Addresses

    Single-node

    1

    1 (only)

    -

    1

    Master/Standby

    1

    2 (default)

    DCS Redis 4.0/5.0 Master/Standby instances support 2 to 10 replicas. Master/Standby instances of other versions 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

    2 (default)

    DCS Redis 4.0/5.0 Redis Cluster instances support 1 to 5 replicas. Redis Cluster instances of other versions support only 2 replicas.

    Not supported

    Number of replicas x Number of shards

Feature FAQs

more