cluster-addslotsrange.3valkey - Man Page

Assigns new hash slot ranges to a node.

Synopsis

CLUSTER ADDSLOTSRANGE start-slot end-slot [start-slot end-slot ...]

Description

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.

Reply

valkey-protocol(7) Simple string reply: OK if the command was successful. Otherwise an error is returned.

Complexity

O(N) where N is the total number of the slots between the start slot and end slot arguments.

Acl Categories

@admin @dangerous @slow

History

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 Valkey Cluster

This command only works in cluster mode and is useful in the following Valkey 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.

See Also

asking(3valkey), cluster(3valkey), cluster-addslots(3valkey), cluster-bumpepoch(3valkey), cluster-count-failure-reports(3valkey), cluster-countkeysinslot(3valkey), cluster-delslots(3valkey), cluster-delslotsrange(3valkey), cluster-failover(3valkey), cluster-flushslots(3valkey), cluster-forget(3valkey), cluster-getkeysinslot(3valkey), cluster-help(3valkey), cluster-info(3valkey), cluster-keyslot(3valkey), cluster-links(3valkey), cluster-meet(3valkey), cluster-myid(3valkey), cluster-myshardid(3valkey), cluster-nodes(3valkey), cluster-replicas(3valkey), cluster-replicate(3valkey), cluster-reset(3valkey), cluster-saveconfig(3valkey), cluster-set-config-epoch(3valkey), cluster-setslot(3valkey), cluster-shards(3valkey), cluster-slots(3valkey), readonly(3valkey), readwrite(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual