Redis answers MOVED with a slot number and another node's address
Fix it fast
Most common cause, 1 of 3The application uses a single-node client against a cluster
Create the connection with your library's cluster client.
// node-redis 6
import { createCluster } from 'redis';
const cluster = await createCluster({
rootNodes: [{ url: 'redis://10.0.0.1:6379' }],
defaults: { password: process.env.REDIS_PASSWORD }
}).on('error', err => console.error('Redis Cluster Error', err)).connect();
// ioredis 6
const cluster = new Redis.Cluster([{ host: '10.0.0.1', port: 6379 }]);
# redis-py 8
from redis.cluster import RedisCluster
rc = RedisCluster(host='10.0.0.1', port=6379)Short answer
A Redis MOVED reply means the node you asked does not own that key's hash slot, and it names the node that does. Cluster-aware clients follow it silently, so seeing it means your client or redis-cli runs in single-node mode. Use createCluster, Redis.Cluster or RedisCluster, run redis-cli -c, or use a proxied endpoint. Applies to Redis 8.10.
Which cause do you have?
Ask the endpoint whether it runs as a cluster, and which slot your key maps to. cluster_enabled:1 together with a MOVED reply means the client has to speak the cluster protocol or go through a proxy.
redis-cli -h my-redis.example.com -p 6379 INFO cluster
redis-cli -h my-redis.example.com -p 6379 CLUSTER KEYSLOT user:42Then find the line you see in this list and open its fix:
- 1The application uses a single-node client against a cluster
Some keys work and others fail with MOVED, and the code builds its connection with createClient, new Redis() or redis.Redis - 2redis-cli was started without cluster mode
The error appears in an interactive redis-cli session as (error) MOVED, while the application itself works - 3Azure Managed Redis uses the OSS cluster policy with a client that cannot follow it
The host ends in redis.azure.net, you connect on port 10000, and the MOVED replies point to ports in the 85xx range
What does the error look like?
MOVED 3999 127.0.0.1:6381(error) MOVED 12182 127.0.0.1:7002
Cause 1 of 3
The application uses a single-node client against a cluster
You seeSome keys work and others fail with MOVED, and the code builds its connection with createClient, new Redis() or redis.Redis
Check
Redis Cluster nodes never proxy commands. A node that does not serve a key's hash slot replies with MOVED, the slot and the right node's address, and expects the client to resend the command there. A plain client treats that reply as an error, so only keys that happen to live on the node you connected to succeed.
grep -rnE "createClient\(|new Redis\(|redis\.Redis\(" srcFix
Create the connection with your library's cluster client. It learns which node owns each slot, sends every command there and follows MOVED replies for you. In node-redis, put shared options such as password and TLS under defaults, because settings on rootNodes only apply to the discovery connection.
// node-redis 6
import { createCluster } from 'redis';
const cluster = await createCluster({
rootNodes: [{ url: 'redis://10.0.0.1:6379' }],
defaults: { password: process.env.REDIS_PASSWORD }
}).on('error', err => console.error('Redis Cluster Error', err)).connect();
// ioredis 6
const cluster = new Redis.Cluster([{ host: '10.0.0.1', port: 6379 }]);
# redis-py 8
from redis.cluster import RedisCluster
rc = RedisCluster(host='10.0.0.1', port=6379)Verify
Reads and writes for keys in different slots all succeed, and no MOVED reaches your logs.
redis-cli -c -h 10.0.0.1 -p 6379 GET user:42Confirmed by redis.io
Cause 2 of 3
redis-cli was started without cluster mode
You seeThe error appears in an interactive redis-cli session as (error) MOVED, while the application itself works
Check
redis-cli stays on the node you connected to unless you start it with -c. With that flag it follows -ASK and -MOVED redirections and prints Redirected to slot instead of an error.
redis-cli -h 10.0.0.1 -p 6379 GET user:42Fix
Reconnect with -c, which makes redis-cli follow each redirection to the node that owns the slot.
redis-cli -c -h 10.0.0.1 -p 6379Verify
Commands on any key return a value, with a Redirected to slot line when the key lives elsewhere.
redis-cli -c -h 10.0.0.1 -p 6379 SET user:42 okConfirmed by redis.io
Cause 3 of 3
Azure Managed Redis uses the OSS cluster policy with a client that cannot follow it
You seeThe host ends in redis.azure.net, you connect on port 10000, and the MOVED replies point to ports in the 85xx range
Check
Under the OSS clustering policy, Azure Managed Redis exposes the Redis Cluster API: the first connection goes to port 10000 and the client must then open its own connections to shards on 85xx ports. TLS is required by default on all of them. Older or specialised client libraries that cannot do this see the redirections as errors.
REDISCLI_AUTH="$REDIS_KEY" redis-cli -h my-cache.region.redis.azure.net -p 10000 --tls --cacertdir /etc/ssl/certs INFO clusterFix
Switch the application to a cluster-capable client as in cause 1, with TLS also set for the shard connections. If that library cannot speak the cluster API, use the Enterprise clustering policy instead, which routes every request through a single proxy endpoint.
// node-redis 6: TLS must be set for the discovered shard connections too
const cluster = await createCluster({
rootNodes: [{ url: 'rediss://my-cache.region.redis.azure.net:10000' }],
defaults: { password: process.env.REDIS_KEY, socket: { tls: true } }
}).connect();Verify
The application reads keys from every shard without MOVED errors.
REDISCLI_AUTH="$REDIS_KEY" redis-cli -c -h my-cache.region.redis.azure.net -p 10000 --tls --cacertdir /etc/ssl/certs GET user:42Confirmed by learn.microsoft.com
How do I stop it coming back?
- Wrap Redis connection setup in one module that chooses the cluster client from configuration, so no other file calls createClient against a cluster endpoint.
- Never hardcode the shard addresses or 85xx ports from a MOVED reply; they can change, and a cluster client discovers them for you.
- Run integration tests against a small cluster rather than a single node when production uses clustering, so single-node code paths fail in CI.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.