Reputation: 7986
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'})
Upvotes: 16
Views: 28562
Reputation: 15315
For get commands you may want to run:
READONLY
first as one of the following might have happened:
- The client sent a command about hash slots never served by the master of this replica.
- The cluster was reconfigured (for example resharded) and the replica is no longer able to serve commands for a given hash slot.
Upvotes: 0
Reputation: 23756
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
Upvotes: 34
Reputation: 3305
The "MOVED" error happens when you connect to one node in a redis cluster with standalone mode, and data you query is on other nodes in the cluster.
I don't know how your StrictRedisCluster
implenmented, but something is definitively wrong in this client.
Upvotes: 1