Get the App
SLTechnology News&Howtos  ›  Database  › 

Principle of redis Cluster data Storage and acquisition

Shulou Source: shulou.com Published: 2022-06-01 05:51:26 11月14日 Update

Redis cluster data acquisition principle:

When client sends commands related to database key to any node in redis cluster

The node receiving the command will calculate which hash slot (hash slot) the key to be processed belongs to.

And first check whether the hash slot belongs to you (jurisdiction):

If the slot in which the key is located happens to be its own (jurisdiction), the node will directly execute the key-related command.

If the slot in which key is located is not its own (jurisdiction), then the node will return a MOVED error to client

Direct the client to the node responsible for the corresponding slot, and the client needs to send the key-related command that you want to execute again.

Principle of redis cluster data storage:

In redis cluster, if you want to deposit a key-value

The key will first take the remainder (and 16384) through the CRC16 algorithm.

The result will correspond to the hash slot (hash slot) between 0 and 16383.

Finally, redis cluster places the key-value in the corresponding hash slot.

Tags: Node command data hash principle cluster location storage between accounting again customer client database algorithm result error processing related check Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno Shulou Technology vpn Shulou Tech Info