Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why redis cluster resharding is not automatically?

Tags:

redis

When I add a node in a redis cluster, it has 0 hash slots. Why redis cluster doesn't automatically does a resharding operation in order to make the new node fully functional?

like image 716
Cosmin Ioniță Avatar asked Aug 03 '15 08:08

Cosmin Ioniță


People also ask

What is Resharding in Redis?

A shard (API/CLI: node group) is a collection of one to six Redis nodes. A Redis (cluster mode disabled) cluster will never have more than one shard. You can create a cluster with higher number of shards and lower number of replicas totaling up to 90 nodes per cluster.

Does Redis use consistent hashing?

Redis Cluster does not use consistent hashing, but a different form of sharding where every key is conceptually part of what we call a hash slot. There are 16384 hash slots in Redis Cluster, and to compute the hash slot for a given key, we simply take the CRC16 of the key modulo 16384.

How is data stored in Redis cluster?

In Redis, data resides in one place in a cluster (Redis Cluster), and each node or shard has a portion of the keyspace. A cluster is divided up among 16,384 slots — the maximum number of nodes or shards in a Redis cluster.


2 Answers

As you can see here, redis supports now automatic partitioning.

like image 191
John Avatar answered Nov 08 '22 18:11

John


The process of adding a node consists of two steps:

  1. Introduce the node to other nodes via CLUSTER MEET so that all the nodes start to communicate via cluster bus
  2. Make the node to act as Master via CLUSTER ADDSLOTS or as a slave via CLUSTER REPLICATE

The separation helps to keep the commands simple.

Automatic resharding is part of the Redis 4.2 roadmap

like image 42
Volodymyr Kostin Avatar answered Nov 08 '22 17:11

Volodymyr Kostin