Updated on 2024-07-29 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: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

    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

    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 6.0 instances support 1 to 2 replicas.

    Not supported

    Number of replicas x Number of shards