简体   繁体   English

Redis memory 用法 CLI 在集群上不起作用

[英]Redis memory usage CLI does not work on cluster

I using the go-redis library to check memory usage of a specific key on a Redis cluster.我使用 go-redis 库检查 memory 在 Redis 集群上对特定密钥的使用情况。 The library fails sporadically with error "redis: nil" which usually means that it accesses the wrong redis instance to find the key.该库偶尔会失败并出现错误“redis:nil”,这通常意味着它访问了错误的 redis 实例以查找密钥。 The go-redis library is using the Redis CLI: "command" to get the list of arguments for each command, and to find where is the redis key position in the arguments list. The go-redis library is using the Redis CLI: "command" to get the list of arguments for each command, and to find where is the redis key position in the arguments list.

Specifically for the memory CLI, the output of the "command" CLI is:特别是对于 memory CLI,“命令”CLI 的 output 是:

157) 1) "memory"
     2) (integer) -2
     3) 1) readonly
        2) random
     4) (integer) 0
     5) (integer) 0
     6) (integer) 0

The Redis document: https://redis.io/commands/command items 4 and 5 are the positions of the first key in arguments, and the last key in arguments. The Redis document: https://redis.io/commands/command items 4 and 5 are the positions of the first key in arguments, and the last key in arguments.

But the values are zero?但值为零? According to the memory CLI document: https://redis.io/commands/memory-usage The items 4 and 5 should both have the value 3.根据 memory CLI 文档: https://redis.io/commands/memory-usage项目 4 和 5 应该都具有值 3。

Is this a bug in the output of the redis "command" CLI, or am I misunderstanding this?这是 redis“命令”CLI 的 output 中的错误,还是我误解了这个?

This is a design issue in redis, see https://github.com/redis/redis/issues/7493这是 redis 中的设计问题,请参阅https://github.com/redis/redis/issues/7493

The final action was that a merge of a pull request: https://github.com/go-redis/redis/pull/1400最后的操作是合并拉取请求: https://github.com/go-redis/redis/pull/1400

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM