CLUSTER MIGRATESLOTS · Valkey

CLUSTER MIGRATESLOTS

Migrate the given slots from this node to the specified nodes.

Usage

CLUSTER MIGRATESLOTS SLOTSRANGE start-slot end-slot [start-slot end-slot …] NODE node-id [SLOTSRANGE start-slot end-slot [start-slot end-slot …] NODE node-id …]

Description

CLUSTER MIGRATESLOTS initiates an asynchronous migration of the designated slot range(s) to the specified target node using atomic slot migration.

This command allows for many slot ranges in a single migration through repeated start and end slot pairs within the SLOTSRANGE block. It also supports multiple migrations in one command, through repeated SLOTSRANGE and NODE blocks. For example:

CLUSTER MIGRATESLOTS SLOTSRANGE 0 9 20 29 NODE <target A> SLOTSRANGE 10 19 NODE <target B>

Initiates two slot migration jobs, one to <target A> with 20 slots (0-9 inclusive, 20-29 inclusive) and another to <target B> with 10 slots (10-19 inclusive).

OK is returned if all slot migrations are successfully initiated, otherwise an error message is returned and no slot migrations are initiated.

To check on the progress of the slot migration, use the CLUSTER GETSLOTMIGRATIONS command.

Complexity

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

ACL Categories

@admin @dangerous @slow

History

See also

ASKING, CLUSTER, CLUSTER ADDSLOTS, CLUSTER ADDSLOTSRANGE, CLUSTER BUMPEPOCH, CLUSTER CANCELSLOTMIGRATIONS, CLUSTER COUNT-FAILURE-REPORTS, CLUSTER COUNTKEYSINSLOT, CLUSTER DELSLOTS, CLUSTER DELSLOTSRANGE, CLUSTER FAILOVER, CLUSTER FLUSHSLOTS, CLUSTER FORGET, CLUSTER GETKEYSINSLOT, CLUSTER GETSLOTMIGRATIONS, CLUSTER HELP, CLUSTER INFO, CLUSTER KEYSLOT, CLUSTER LINKS, CLUSTER MEET, CLUSTER MYID, CLUSTER MYSHARDID, CLUSTER NODES, CLUSTER REPLICAS, CLUSTER REPLICATE, CLUSTER RESET, CLUSTER SAVECONFIG, CLUSTER SET-CONFIG-EPOCH, CLUSTER SETSLOT, CLUSTER SHARDS, CLUSTER SLOT-STATS, CLUSTER SLOTS, CLUSTER SYNCSLOTS, READONLY, READWRITE.