CLUSTER ADDSLOTSRANGE

CLUSTER ADDSLOTSRANGE

CLUSTER ADDSLOTSRANGE range
Available since
7.0.0
Time complexity
O(N) where N is the total number of the slots between the start slot and end slot arguments.
ACL categories
@admin, @slow, @dangerous

The CLUSTER ADDSLOTSRANGE is similar to the CLUSTER ADDSLOTS command in that they both assign hash slots to nodes.

The difference between the two commands is that CLUSTER ADDSLOTS takes a list of slots to assign to the node, while CLUSTER ADDSLOTSRANGE takes a list of slot ranges (specified by start and end slots) to assign to the node.

Example #

To assign slots 1 2 3 4 5 to the node, the CLUSTER ADDSLOTS command is:

> CLUSTER ADDSLOTS 1 2 3 4 5
OK

The same operation can be completed with the following CLUSTER ADDSLOTSRANGE command:

> CLUSTER ADDSLOTSRANGE 1 5
OK

Usage in Redict Cluster #

This command only works in cluster mode and is useful in the following Redict Cluster operations:

  1. To create a new cluster, CLUSTER ADDSLOTSRANGE is used to initially set up master nodes splitting the available hash slots among them.
  2. In order to fix a broken cluster where certain slots are unassigned.

Redict logo courtesy of @janWilejan, CC-BY-SA-4.0. Download SVG ⤑

Portions of this website courtesy of Salvatore Sanfilippo, CC-BY-SA-4.0.