Home> Database> Redis> body text

How does redis cluster allocate hash slots

(*-*)浩
Release: 2019-12-02 09:03:28
Original
3817 people have browsed it

How does redis cluster allocate hash slots

Redistribute the hash:

ip:port is the ip and port of any node in the current redis cluster (recommended learning:Redis video tutorial)

redis-cli --cluster reshard ip:port
Copy after login

The operation is as shown:

How does redis cluster allocate hash slots

There are two allocation hash slots Methods:

1. Take out an appropriate number of hash slots on other nodes and allocate them to the target node

2. Take out a specified number of hash slots on the specified node and allocate them to Target node

As shown above, the number of hash slots of the master node with port number 7005 is 0, and 300 hash slots are allocated to it:

How does redis cluster allocate hash slots

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

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

How does redis cluster allocate hash slots

Here is to let You choose the source of hash slots that need to be allocated. There are two options:

1. Enter all. The hash slots that need to be allocated to the target node come from other master nodes of the current cluster (each node takes The number of outputs is automatically determined by the cluster. The above picture is done in this way!)

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

How does redis cluster allocate hash slots

2. Enter the ID of a node. In this case, all the hash slots that need to be allocated to the target node will be borne by the node (you can enter multiple node IDs, press Enter to separate, enter done to end ).

Use the second method to allocate hash slots:

Now the node hash slot of port 7005 is 300, use the second method to allocate it, and then add 100, take the hash slot of 100 on the node with port 7002

How does redis cluster allocate hash slots

View the effect:

How does redis cluster allocate hash slots

The current master node of port 7005 has 400 hash slots!

For more Redis-related technical articles, please visit theRedis Getting Started Tutorialcolumn to learn!

The above is the detailed content of How does redis cluster allocate hash slots. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!