CLUSTER SETSLOT
Since 1.1.0Cluster
Syntax
CLUSTER SETSLOT slot <IMPORTING|MIGRATING|NODE> node-id
CLUSTER SETSLOT slot STABLESets the state of one slot on this node, for moving it by hand.
| Form | Effect |
|---|---|
IMPORTING node-id | On the destination: the slot is coming from node-id. Commands for it are served after ASKING. |
MIGRATING node-id | On the source: the slot is going to node-id. A command for a key that has already left is answered with ASK slot host:port. |
NODE node-id | node-id owns the slot now. Sent to the destination, then to the source. |
STABLE | Clears IMPORTING or MIGRATING. |
Moving a slot by hand takes four steps, which redis-cli --cluster reshard drives:
CLUSTER SETSLOT slot IMPORTING source-idon the destination;CLUSTER SETSLOT slot MIGRATING destination-idon the source;MIGRATEthe slot's keys, in batches, from the source;CLUSTER SETSLOT slot NODE destination-idon the destination, then on the source.
A multi-key command whose keys are partly on each side meanwhile is answered with TRYAGAIN. CLUSTER MIGRATION moves slots in one command, without ASK.
A node that loses a slot to another master, by SETSLOT ... NODE or on the losing side of a partition, deletes the keys it holds in that slot.
Reply
OK.ERR Unknown node.ERR Unknown SETSLOT subcommand 'name'.
Examples
> CLUSTER SETSLOT 2780 IMPORTING b2744aeada9b56dd000f101f31447a33a15c9b08
OK
On the source, once the key has gone:
> GET user:7
(error) ASK 2780 127.0.0.1:17622