Error: redis moved exception
What's Causing This Error
The 'redis moved exception' error is caused when a Redis cluster is redistributing slots. When a slot changes nodes, any clients trying to access that slot on the old node will get this error message. External events such as node failure or cluster configuration changes are usually responsible for this error.
Solution - Here's How To Resolve It
Updating your Redis client library to support automatic redirection is the way to resolve the 'redis moved exception' error. This means the client should automatically redirect to the new node responsible for the moved slot when it gets this error. Most Redis client libraries support this feature, so check the documentation for your library to find out how to enable it.
Using a load balancer or proxy that knows the Redis cluster topology is another solution. Such load balancers can route requests to the correct node and transparently handle redirection for the client. HAProxy, Redis Sentinel, and Redis Cluster Proxy are some popular options for this.
Manually updating your client configuration to point to the new node responsible for the moved slot is also a possible solution. However, it requires you to keep track of the Redis cluster topology manually and can be prone to errors if not done correctly.
Was this content helpful?
Other Common Redis Errors (with Solutions)
- could not connect to redis at 127.0.0.1:6379: connection refused
- redis error server closed the connection
- redis.exceptions.responseerror: value is not an integer or out of range
- redis.exceptions.responseerror moved
- redis.exceptions.responseerror noauth authentication required
- redis-server failed to start advanced key-value store
- spring boot redis unable to connect to localhost 6379
- unable to configure redis to keyspace notifications
- redis.clients.jedis.exceptions.jedismoveddataexception
- could not get resource from pool redis
- failed to restart redis service unit redis service not found
- job for redis-server.service failed because a timeout was exceeded
Switch & save up to 80%
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost