How to Fix the Redis 'MOVED' Redirection Error in Cluster Mode

intermediate🔴 Redis2026-04-23| Redis Cluster (v3.0+) running on Linux, Docker, or Kubernetes.

Error Message

MOVED 7638 127.0.0.1:7001
#redis#cluster#devops#database#troubleshooting

The Error MessageIf you have ever tried to run a simple SET or GET command in a Redis Cluster and were greeted with a cryptic response like the one below, you aren't alone.

(error) MOVED 7638 127.0.0.1:7001

In application logs, this might appear as a Redis.Exceptions.ClusterException. It typically happens when you connect to a single node in the cluster as if it were a standalone instance, rather than using a connection that understands the cluster's distributed architecture.

Why Is This Happening?A Redis Cluster doesn't store all data on every node. Instead, it partitions data across exactly 16,384 hash slots. Every node in your cluster is responsible for a specific range of these slots. For example, Node A might handle slots 0 to 5460, while Node B handles 5461 to 10922.

When you see MOVED 7638 127.0.0.1:7001, Redis is being helpful. It is telling you: "The key you want belongs to hash slot 7638, but I don't own that slot. Node 127.0.0.1:7001 does. Go talk to them instead." Technically, this isn't a failure. It is a redirection mechanism. However, if your client doesn't know how to follow that map, it treats the suggestion as an error.

Step-by-Step Fix### 1. Fix for Command Line (redis-cli)By default, redis-cli operates in standalone mode. To fix the redirection error, you must explicitly enable Cluster Mode using the -c flag.

The Wrong Way:

redis-cli -h 127.0.0.1 -p 7000
127.0.0.1:7000> SET user:101 "John"
(error) MOVED 7638 127.0.0.1:7001

The Right Way:

redis-cli -c -h 127.0.0.1 -p 7000
127.0.0.1:7000> SET user:101 "John"
-> Redirected to slot [7638] located at 127.0.0.1:7001
OK

The -c flag tells the CLI to automatically hop to the correct node based on the MOVED response. It makes the redirection seamless.

2. Fix for Application CodeIf your app is throwing this error, you are likely using a standalone Redis client. You need to switch to a "Cluster-aware" client that can fetch the cluster slots map (the topology) upon connection.

  • Python: Switch from redis.Redis to redis.cluster.RedisCluster.- Node.js: Use ioredis in cluster mode (new Redis.Cluster([...])) instead of the standard client.- Java: Use JedisCluster rather than the basic Jedis class.- Go: Use redis.NewClusterClient from the popular go-redis package.Cluster-aware clients handle redirections internally. They calculate the CRC16 hash of your key to determine the slot before even sending the request, ensuring they hit the right node on the first try.

3. Check Your Cluster HealthIf the error persists despite using the correct client, your cluster topology might be out of sync. Check the status of your slots with this command:

redis-cli -p 7000 cluster nodes

Verify that the node mentioned in the error (e.g., 127.0.0.1:7001) is marked as connected and master. If a node fails and a replica hasn't been promoted, the slot might become unreachable.

VerificationConfirm your fix by following these steps:

  • Connect using redis-cli -c.- Run CLUSTER KEYSLOT <your_key> to identify the specific slot assigned to your key.- Run your SET or GET command.- Look for the message -> Redirected to slot.... If the operation completes successfully, your environment is now correctly handling the Redis Cluster protocol.## Expert Tips- Seed Nodes: Don't just provide one IP in your app configuration. List at least 3 nodes as "seed" nodes. If one is down during startup, your app can still fetch the cluster map from the others.- Docker & NAT: If you are running in Docker and MOVED points to an unreachable internal IP (like 172.17.x.x), you must set cluster-announce-ip in your redis.conf to the host's public IP.- The CROSSSLOT Error: When using multi-key operations like MSET, all keys must reside in the same slot. Use Hash Tags—like {user123}:profile and {user123}:settings—to force related keys onto the same node.

Related Error Notes