CodePark/ questions / Replication, Sentinel & Cluster
START PRACTICINGPRACTICE
Backend question · Redis & caching › Replication, Sentinel & Cluster

In Redis Cluster, what are MOVED and ASK redirections, and how should a client handle each?

MOVED means a slot now belongs to another node for good. ASK is a one-time redirect while a slot is being moved.

MOVED <slot> <host:port> appears after a slot changes owner, for example after resharding or failover. The client should:

  • resend the command to that node
  • update its slot map, often by reloading the whole map with CLUSTER SHARDS or CLUSTER SLOTS

Then later commands go straight to the right node.

ASK <slot> <host:port> appears while a slot is being migrated, when the key you asked for has already moved to the target node. The client sends ASKING and then the command to the target node. It does not update its slot map. Why? The slot still officially belongs to the source node until the migration finishes.

Cluster-aware clients like ioredis handle both automatically. If you see many MOVED replies, the client's slot map is out of date.

  • MOVED means the slot's owner changed for good.
  • On MOVED, retry on the new node and update the slot map.
  • ASK means the slot is mid-migration, so it is a one-time redirect.
  • On ASK, send ASKING then the command, and keep the old slot map.
  • Cluster-aware clients handle both redirects automatically.