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 writing / querying data in Redis cluster (theory)

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Redis Cluster Data Storage Principle:

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

This key is first residuated by CRC16 (and 16384),

The result corresponds to a hash slot between 0 and 16383.

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

Redis Cluster Data Acquisition Principle:

When a client sends a command related to a database key to any node in the redis cluster,

The node receiving the command calculates which hash slot the key to be processed belongs to,

And check whether this hash slot belongs to itself (jurisdiction):

If the slot where the key is located happens to belong to itself (jurisdiction), the node will directly execute the key-related command.

If the slot where the key is located does not belong to itself (jurisdiction), then the node will return a MOVED error to the client,

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

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