# CLUSTER ADDSLOTS

> Assign one or more hash slots to the node that receives the command.

URL: https://docs.hotkv.com/commands/cluster-addslots/

```
CLUSTER ADDSLOTS slot [slot ...]
```

- Group: Cluster
- Complexity: O(N) where N is the number of slots
- 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](https://docs.hotkv.com/commands/cluster-set-config-epoch/index.md).

## 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

```
127.0.0.1:6379> CLUSTER ADDSLOTS 0 1 2
OK
127.0.0.1:6379> CLUSTER ADDSLOTS 2 3
(error) ERR Slot 2 is already busy
127.0.0.1:6379> CLUSTER ADDSLOTS 4 4
(error) ERR Slot 4 specified multiple times
127.0.0.1:6379> CLUSTER ADDSLOTS 16384
(error) ERR Invalid or out of range slot
```

## Compatibility

Same checks, replies and error strings as Redis 7 and Valkey 8.

## See also

[CLUSTER ADDSLOTSRANGE](https://docs.hotkv.com/commands/cluster-addslotsrange/index.md),
[CLUSTER DELSLOTS](https://docs.hotkv.com/commands/cluster-delslots/index.md),
[CLUSTER SETSLOT](https://docs.hotkv.com/commands/cluster-setslot/index.md),
[CLUSTER SLOTS](https://docs.hotkv.com/commands/cluster-slots/index.md)

In a cluster: [Scaling a cluster](https://docs.hotkv.com/clustering/scaling/index.md#resharding-by-hand)