Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Principle of redis Cluster data Storage and acquisition

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report