适用于 Redis 的 AWS Elasticache:如何修复错误 TYPE returned an error: MOVED or Error: MOVED

问题描述 投票:0回答:1

我有一个 AWS Elasticache for Redis 配置启用了集群模式,使用 multi az 和 5 个分片和 3 个节点(1 个主节点和 2 个副本)。

从运行最新的 Amazon Linux 2023 的 EC2 实例,我已经安装了

redis-cli tool
.

我正在尝试为

bigkeys
hotkeys
收集数据,但是对于每次 redis-cli 运行,我得到不同的结果(两个错误):

~> redis6-cli -c -h myinstance.cache.com -p 6379 --tls --hotkeys

# Scanning the entire keyspace to find hot keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

Error: MOVED 6787 node.myinstance.cache.com:6379
~> redis6-cli -c -h myinstance.cache.com -p 6379 --tls --bigkeys

# Scanning the entire keyspace to find hot keys as well as
# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec
# per 100 SCAN commands (not usually needed).

TYPE returned an error: MOVED 6787 node.myinstance.cache.com:6379

我对上面的错误做了很多研究,我能发现的是你应该使用

-c
命令行开关来启用 redis-cli 以遵循
MOVED
错误/消息,但是可以看出,我正在使用它。

REPL 适用于获取、设置和删除键。我尝试使用

--scan
参数,它也有效。

amazon-web-services redis amazon-elasticache
1个回答
0
投票

好像是redis-cli的问题,见https://github.com/redis/redis/issues/4810.

可以使用以下解决方法:

  1. 使用 redis-cli 连接到集群配置端点
  2. 通过执行集群节点找到主节点:
    redis6-cli -h configurationendpoint.cache.com -p 6379 --tls cluster nodes
  3. 针对的节点端点运行 bigkeys 和 hotkeys 单个主节点:
    redis6-cli -c -h myinstance.001.cache.com -p 6379 --tls --bigkeys

此外,您可以使用 redis-cli 'check' 命令来查找是否有多个插槽所有者:

redis6-cli --tls --cluster check configurationendpoint.cache.com:6379 --cluster-search-multiple-owners
。 如果有的话,可以联系ElastiCache支持,看看是否需要修复集群拓扑

© www.soinside.com 2019 - 2024. All rights reserved.