Dragonfly Cloud announces new enterprise security features - learn more

Dragonfly

Error: redis moved exception

Solution

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)

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

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