CLUSTER MIGRATION <IMPORT start-slot end-slot [start-slot end-slot ...] | CANCEL <ID task-id | ALL> | STATUS <ID task-id | ALL>
@admin,
@slow,
@dangerous,
The CLUSTER MIGRATION command provides atomic slot migration functionality for Redis Cluster. This command allows you to import slots from other nodes, monitor the progress of migration tasks, and cancel ongoing migrations.
subcommandThe subcommand specifies the operation to perform:
IMPORT <start-slot> <end-slot> [<start-slot> <end-slot> ...]: Executes on the destination master. Accepts multiple slot ranges and triggers atomic migration for the specified ranges. Returns a task ID that you can use to monitor the status of the task.
CANCEL <ID <task-id> | ALL>: Cancels an ongoing migration task by its ID or cancels all tasks if ALL is specified. Note: Cancelling a task on the source node does not stop the migration on the destination node, which will continue retrying until it is also cancelled there.
STATUS [ID <task-id> | ALL]: Displays the status of current and completed atomic slot migration tasks. If a specific task ID is provided, it returns detailed information for that task only. If ALL is specified, it returns the status of all ongoing and completed tasks.
Import slots 0-1000 and 2000-3000 to the current node:
CLUSTER MIGRATION IMPORT 0 1000 2000 3000
Check the status of all migration tasks:
CLUSTER MIGRATION STATUS ALL
Check the status of a specific migration task:
CLUSTER MIGRATION STATUS ID 24cf41718b20f7f05901743dffc40bc9b15db339
Cancel a specific migration task:
CLUSTER MIGRATION CANCEL ID 24cf41718b20f7f05901743dffc40bc9b15db339
Cancel all migration tasks:
CLUSTER MIGRATION CANCEL ALL
| Redis Enterprise |
Redis Cloud |
Notes |
|---|---|---|
| ❌ Standard ❌ Active-Active |
❌ Standard ❌ Active-Active |
For the IMPORT subcommand:
Bulk string reply: task ID on success, or error message on failure.
For the CANCEL subcommand:
Integer reply: number of cancelled tasks.
For the STATUS subcommand:
Array reply: a list of migration task details. Each task is represented as an array containing field-value pairs:
id: Task identifierslots: Slot range being imported or migratedsource: Source node IDdest: Destination node IDoperation: Operation type ("import" or "migrate")state: Current state ("completed", "in_progress", etc.)last_error: Last error message (empty if none)retries: Number of retry attemptscreate_time: Task creation timestampstart_time: Task start timestampend_time: Task completion timestamp (if completed)write_pause_ms: Write pause duration in millisecondsCLUSTER MIGRATION STATUS output, the "state" field will show completed for successful operations.During atomic slot migration operations, keys in unowned slots may be filtered out from the following commands while importing or trimming is in progress:
The INFO KEYSPACE command will continue to reflect the actual number of keys, including those being imported.
cluster-slot-migration-handoff-max-lag-bytes: After slot snapshot completion, if remaining replication stream size falls below this threshold, the source node pauses writes to hand off slot ownership. Higher values trigger handoff earlier but may cause longer write pauses. Lower values result in shorter write pauses but may be harder to reach with steady incoming writes (default: 1MB).cluster-slot-migration-write-pause-timeout: Maximum duration that the source node pauses writes during ASM handoff. If the destination fails to take over slots within this timeout, the source assumes migration failed and resumes writes (default: 10 seconds).