rediscommand-line-interfaceredis-cluster

Get all keys in Redis cluster


I am using Redis cluster version redis-5.0.5. I want to see all the keys present in my Redis cluster. I know for standalone we use KEYS * to get all the keys.

what is the way to see all keys in Redis cluster?

$ redis-cli -h hostname -p 90001 -c 
hostname:90001> KEYS *
(empty list or set)

// I have data on my cluster 

Solution

  • Basically, you'd need to run KEYS * (not in production, please!) on every one of the nodes. The cli can do this with the '--cluster call' command, like so:

    redis-cli --cluster call hostname:90001 KEYS "*"