MOVED: The key lives on another cluster node
In Redis Cluster the key's hash slot is owned by a different node, which replies with the slot number and the address that owns it.
- Error prefix
MOVED- Category
- Cluster and replication
What it means
MOVED is how Redis Cluster routes. Every key maps to one of 16384 slots (CRC16 of the key modulo 16384), each slot belongs to exactly one node, and a node that receives a command for a slot it does not own refuses it with MOVED slot host:port, telling the client where the key actually lives.
A cluster-aware client follows the redirect and re-sends to the reported endpoint. You see the error itself when the client is not cluster-aware (plain redis-cli without -c, a naive connection pool), when a resharding changed the slot map and a client has not refreshed yet, or when you point at one node deliberately for debugging. MOVED is normal protocol traffic, not a fault: the command did not run, but the cluster told you exactly where to run it.
Common causes
- A cluster-unaware client sent the command to a node that does not own the key's slot.
- The slot map changed through resharding or failover, and the client is still using its cached map.
- During maintenance you connected to a single node directly instead of through the cluster.
Find the cause
redis-cli -p 7000 CLUSTER KEYSLOT foo redis-cli -p 7000 CLUSTER MYID redis-cli -p 7000 CLUSTER SLOTS # Compare the owner of slot 12182 with the endpoint named in the MOVED reply
Anatomy of a MOVED reply
| MOVED | The prefix: this node refused the command and named the slot's owner. |
|---|---|
| 12182 | The hash slot the key maps to, CRC16 of the key modulo 16384. |
| 127.0.0.1:7002 | The endpoint that owns the slot now; re-send the command there. |
How to fix it
-
Find which slot the key hashes to, then ask the cluster who owns it:
redis-cli -p 7000 CLUSTER KEYSLOT foo # (integer) 12182 redis-cli -p 7000 CLUSTER SLOTS
-
Use a cluster-aware client, or redis-cli with -c, which follows the redirect for you:
redis-cli -c -p 7000 SET foo bar # -> Redirected to slot [12182] located at 127.0.0.1:7002 # OK
-
If errors persist after a reshard, force the client to rebuild its slot map by reconnecting; most libraries also refresh on every MOVED they receive.
Other ways to handle it
Hash tags keep related keys in one slot: keys like {user:1000}:profile and {user:1000}:session hash on the part in braces, so multi-key commands on one user stop bouncing between nodes. For application code, a cluster-aware client removes the problem entirely instead of handling it after the fact.
Reproduce it safely
redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 --cluster-replicas 0 redis-cli -p 7000 SET foo bar # (error) MOVED 12182 127.0.0.1:7002 redis-cli -c -p 7000 SET foo bar # OK (the redirect was followed)
Questions
Is MOVED a problem I need to fix?
Not on its own. Cluster-aware clients follow it automatically. Act only when a client keeps failing: it is not following redirects, or its slot map has gone stale.
How is the slot number computed?
CRC16 of the key modulo 16384. If the key contains {braces}, only the part inside them is hashed, which is how hash tags pin keys to the same slot.
Related errors
ASKThe key is migrating to another nodeCROSSSLOTMulti-key command spans two slotsCLUSTERDOWNThe cluster cannot serve this slot
More cluster and replication errors
READONLYWrite rejected on a read only replicaMASTERDOWNStale data is not allowed to be servedTRYAGAINSlot is rehashing, retry the commandNOREPLICASToo few healthy replicas to write
The code and message text are from the Redis documentation and source code. Browse the full Redis error list or search every database error.
Work on Redis in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.
Text and data on this page: CC BY 4.0, credit SQLly (sqlly.app). Code and SQL snippets: MIT. License details Quoted error message text belongs to its database vendor. View as Markdown