# CLUSTER ADDSLOTSRANGE

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

URL: https://docs.hotkv.com/commands/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
- HotKV Cloud: not available
- On-Premise: no license needed

`CLUSTER ADDSLOTSRANGE` works like
[CLUSTER ADDSLOTS](https://docs.hotkv.com/commands/cluster-addslots/index.md), 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

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

```
127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 0 5460
OK
127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 5461 6000 5900 7000
(error) ERR Slot 5900 specified multiple times
127.0.0.1:6379> CLUSTER ADDSLOTSRANGE 9000 8000
(error) ERR start slot number 9000 is greater than end slot number 8000
```

## Compatibility

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

## See also

[CLUSTER ADDSLOTS](https://docs.hotkv.com/commands/cluster-addslots/index.md),
[CLUSTER DELSLOTSRANGE](https://docs.hotkv.com/commands/cluster-delslotsrange/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)