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

How the redis cluster allocates hash slots

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

Share

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

Reassign Hashi Cao:

Ip:port is any node ip and port of the current redis cluster

Redis-cli-cluster reshard ip:port

The operation is shown in the figure:

There are two ways to allocate hash slots:

1. Assign an appropriate amount of hash slots to the target node in other nodes

2. Assign a specified number of hash slots to the target node at the specified node

As shown in the figure above, the number of hash slots of the master node with port number 7005 is 0, and it is assigned 300 hash slots:

How many slots do you want to move (from 1 to 16384)? Enter the number of hash slots you want to allocate here (as shown above)

What is the receiving node ID? Enter here to assign the specified number of hash slots in the previous step to that node, and enter the node id (as shown above)

This allows you to choose the source of the hash slot you need to allocate, and there are two options:

1. Input all requires the hash slot assigned to the target node to come from the other master nodes of the current cluster (the number of each node is automatically determined by the cluster. The figure above is done in this way! )

Effect (the number of primary node hash slots of the original port 7005 is 0):

2. Enter the id of a node. In this case, all the hash slots that need to be assigned to the target node are borne by the node (node id can be entered multiple, enter to split, enter done to end).

Use the second way to allocate hash slots:

Now the node hash slot of port 7005 is 300. use the second way to assign it, and add 100. the hash slot of port 7002 will be taken from the node of port 7002.

View the results:

The current primary node of port 7005 is 400 hash slot!

These are the details of how the redis cluster allocates hash slots. Please pay more attention to other related articles!

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