AWS Redis Cluster - MOVE error

user1187968 picture user1187968 · Jan 12, 2018 · Viewed 8.4k times · Source

I try to execute a hmset command on AWS Redis Cluster, and I'm getting the following "moved" error. Not sure what is going on.

MOVED 7652 10.0.4.210:6379

from rediscluster import StrictRedisCluster

startup_nodes = [{"host": self.host, "port": self.port}]
client = StrictRedisCluster(startup_nodes=startup_nodes,
                                        decode_responses=True,
                                        skip_full_coverage_check=True)

client.hmset('my_key', {'abc':'123'})

Answer

Muhammad Soliman picture Muhammad Soliman · Oct 26, 2018

As your data is sharded and distributed into different nodes in the cluster, you should use -c option to be able to connect to redis in cluster mode.

In your question, it is not known what type of client library you using, however the same concept, you need to use a library that supports cluster mode. Here is a list of client packages in nodejs

If you're trying to get data it will redirect you as a client to the correct shard/partition that holds the requested data.

if you have redis-cli, you can try this:

redis-cli -c -h {REDIS_HOST_OR_PORT} -p 6379 

if you have docker installed, you can connect to the cluster using the following:

docker run -ti --rm redis redis-cli -c -h {REDIS_HOST_OR_IP} -p 6379