CLUSTER ADDSLOTSRANGE
CLUSTER ADDSLOTSRANGE start-slot end-slot [start-slot end-slot ...]
- Group
- Cluster
- Complexity
- O(N) where N is the total number of slots in the ranges
- Arity
- -4 (at least 4 words, counting the command name)
- HotKV Cloud
- Not available
- On-Premise
- no license needed
CLUSTER ADDSLOTSRANGE works like
CLUSTER ADDSLOTS, but takes inclusive ranges
of slots instead of single slots. CLUSTER ADDSLOTSRANGE 0 5460 claims the
same slots as listing 0 to 5460 one by one.
The ranges are checked in order, and nothing is assigned unless every slot of every range passes. A slot can be added only if no node owns it yet in this node’s view, and no slot may appear in two ranges.
Return value
Section titled “Return value”Simple string OK in RESP2 and RESP3, or one of these errors:
| Case | Error |
|---|---|
| A slot is not an integer from 0 to 16383 | ERR Invalid or out of range slot |
| A range starts after it ends | ERR start slot number <start> is greater than end slot number <end> |
| A slot already has an owner | ERR Slot <slot> is already busy |
| Ranges overlap | ERR Slot <slot> specified multiple times |
| An odd number of slot arguments | ERR wrong number of arguments for 'cluster|addslotsrange' command |
| Cluster mode is off | ERR This instance has cluster support disabled |
Examples
Section titled “Examples”127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 0 5460OK127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 5461 6000 5900 7000(error) ERR Slot 5900 specified multiple times127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 9000 8000(error) ERR start slot number 9000 is greater than end slot number 8000Compatibility
Section titled “Compatibility”Same checks, replies and error strings as Redis 7 and Valkey 8.
See also
Section titled “See also”CLUSTER ADDSLOTS, CLUSTER DELSLOTSRANGE, CLUSTER SLOTS
In a cluster: Scaling a cluster
Was this page helpful?
Thanks for the feedback.