Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

CLUSTER CANCELSLOTMIGRATIONS

Last updated
CLUSTER CANCELSLOTMIGRATIONS
Group
Cluster
Complexity
O(N) where N is the number of migrations in progress
Arity
2 (exactly, counting the command name)
HotKV Cloud
Not available
On-Premise
no license needed

CLUSTER CANCELSLOTMIGRATIONS stops every atomic slot migration that the receiving node is exporting, which are the ones started with CLUSTER MIGRATESLOTS or requested by a target with CLUSTER MIGRATION IMPORT. The slots stay with this node and keep serving. The target deletes the copy it had received.

Send it to the source. It only affects migrations still in progress: a migration that has finished moved the slots, and cancelling cannot move them back (start a new migration from the new owner for that). The node reports each cancelled migration as cancelled in CLUSTER GETSLOTMIGRATIONS, and the target reports it as failed, with the message Connection lost to source.

A task that was started on the target with CLUSTER MIGRATION IMPORT is not over when its export is cancelled: the target keeps retrying the import. Cancel such a task on the target with CLUSTER MIGRATION CANCEL.

Case RESP2 RESP3
Migrations cancelled Simple string OK Simple string OK
No migration of this node is in progress Error ERR No migrations ongoing Same
Cluster mode is off Error ERR This instance has cluster support disabled Same

With nothing running, then with a migration in progress.

127.0.0.1:7000> CLUSTER CANCELSLOTMIGRATIONS
(error) ERR No migrations ongoing
127.0.0.1:7000> CLUSTER MIGRATESLOTS SLOTSRANGE 150 199 NODE 49a04a859cbe2f18b168fdff41f4f2346045f9e3
OK
127.0.0.1:7000> CLUSTER CANCELSLOTMIGRATIONS
OK
127.0.0.1:7000> CLUSTER COUNTKEYSINSLOT 150
(integer) 8
127.0.0.1:7001> CLUSTER COUNTKEYSINSLOT 150
(integer) 0

The same command and the same error text as Valkey 9. Redis 8 has no such command; it cancels with CLUSTER MIGRATION CANCEL.

CLUSTER MIGRATESLOTS, CLUSTER GETSLOTMIGRATIONS, CLUSTER MIGRATION, Scaling a cluster