Updated on 2022-02-21 GMT+08:00

Redis Cluster

DCS provides two types of cluster Redis instances: Proxy Cluster and Redis Cluster. Proxy Cluster uses Linux Virtual Server (LVS) and proxies. Redis Cluster is the native distributed implementation of Redis. Proxy Cluster instances are compatible with Redis 3.0, while Redis Cluster instances are compatible with Redis 4.0 and 5.0.

This section describes Redis Cluster DCS Redis 4.0 and 5.0 instances.

Redis Cluster DCS Redis 4.0 and 5.0 Instances

The Redis Cluster instance type provided by DCS is compatible with the native Redis Cluster, which uses smart clients and a distributed architecture to perform sharding.

Table 1 lists the shard specification for different instance specifications.

Specification per shard=Instance specification/Number of shards. For example, if a 48 GB instance has 6 shards, the specification of each shard is 48 GB/6 = 8 GB.

Table 1 Specifications of Redis Cluster DCS instances

Total Memory

Shards

4 GB/8 GB/16 GB/24 GB/32 GB

3

48 GB

6

64 GB

8

96 GB

12

128 GB

16

192 GB

24

256 GB

32

384 GB

48

512 GB

64

768 GB

96

1024 GB

128

  • Distributed architecture

    Any node in a Redis Cluster can receive requests. Received requests are then redirected to the right node for processing. Each node consists of a subset of one master and one (by default) or multiple replicas. The master or replica roles are determined through an election algorithm.

    Figure 1 Distributed architecture of Redis Cluster
  • Presharding

    There are 16,384 hash slots in each Redis Cluster. The mapping between hash slots and Redis nodes is stored in Redis Servers. To compute what is the hash slot of a given key, simply take the CRC16 of the key modulo 16384. Example command output

    Figure 2 Redis Cluster presharding