CLUSTER ADDSLOTS
CLUSTER ADDSLOTS slot [slot ...]
- Group
- Cluster
- Complexity
- O(N) where N is the number of slots
- Arity
- -3 (at least 3 words, counting the command name)
- HotKV Cloud
- Not available
- On-Premise
- no license needed
CLUSTER ADDSLOTS makes the receiving node the owner of the given hash
slots (0 to 16383). You use it when you build a cluster by hand: each
primary claims its slots, and the other nodes learn about it over the
cluster bus. redis-cli --cluster create does this for you.
Every slot is checked before any is assigned, so the command adds all the slots or none of them. A slot can be added only if no node owns it yet in this node’s view, the node itself included. Adding a slot also ends any import of that slot this node had open.
The node’s configuration epoch does not change, so you can still give each new primary its own epoch with CLUSTER SET-CONFIG-EPOCH.
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 slot already has an owner | ERR Slot <slot> is already busy |
| The same slot is given twice | ERR Slot <slot> specified multiple times |
| Cluster mode is off | ERR This instance has cluster support disabled |
Examples
Section titled “Examples”127.0.0.1:6379> CLUSTER ADDSLOTS 0 1 2OK127.0.0.1:6379> CLUSTER ADDSLOTS 2 3(error) ERR Slot 2 is already busy127.0.0.1:6379> CLUSTER ADDSLOTS 4 4(error) ERR Slot 4 specified multiple times127.0.0.1:6379> CLUSTER ADDSLOTS 16384(error) ERR Invalid or out of range slotCompatibility
Section titled “Compatibility”Same checks, replies and error strings as Redis 7 and Valkey 8.
See also
Section titled “See also”CLUSTER ADDSLOTSRANGE, CLUSTER DELSLOTS, CLUSTER SETSLOT, CLUSTER SLOTS
In a cluster: Scaling a cluster
Was this page helpful?
Thanks for the feedback.