简体   繁体   中英

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. The library fails sporadically with error "redis: nil" which usually means that it accesses the wrong redis instance to find the key. 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:

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.

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.

Is this a bug in the output of the redis "command" CLI, or am I misunderstanding this?

This is a design issue in redis, see 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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