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, 4.0, and 5.0, while Redis Cluster instances are compatible with Redis 4.0 and 5.0.
Read/write splitting is supported by Redis Clusters (Redis 4.0 and 5.0) but not by Proxy Clusters (Redis 3.0, 4.0, and 5.0). Read more about DCS's support for read/write splitting.
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.
When creating a Redis Cluster instance, you can customize the shard size. After the instance is created, the shard size cannot be changed. If the shard size is not customized, the default size is used. Size of a shard = Instance specification/Number of shards. For example, if a 48 GB instance has 6 shards, the size of each shard is 48 GB/6 = 8 GB.
| 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.
Figure 2 Redis Cluster presharding
Last Article: Proxy Cluster Redis
Next Article: Read/Write Splitting
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.