AWS Redis群集-MOVE错误 [英] AWS Redis Cluster - MOVE error

查看:153
本文介绍了AWS Redis群集-MOVE错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在AWS Redis群集上执行hmset命令,并且出现以下已移动"错误.不知道发生了什么.

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.

已移动7652 10.0.4.210:6379

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'})

推荐答案

当您的数据被分片并分布到集群中的不同节点时,您应该使用-c选项以能够在集群模式下连接到Redis.

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.

在您的问题中,不知道您使用的是哪种类型的客户端库,但是,出于相同的概念,您需要使用支持cluster mode的库.这是 nodejs中的客户端软件包列表

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.

如果您拥有redis-cli,则可以尝试以下操作:

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

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

如果已安装docker,则可以使用以下命令连接到群集:

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

这篇关于AWS Redis群集-MOVE错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆