Search code examples
redisredis-cluster

Redis - Total Keys in Cluster


I want to check total number of keys in Redis Cluster.

Is there any direct command available to get this or I have to check with INFO command from each instance / node.


Solution

  • There is no direct way.

    You can do the following with the cli though:

    redis-cli --cluster call one-cluster-node-ip-address:the-port DBSIZE
    

    And then sum the results.

    Alternatively, there's RedisGears with which you can do the following to get the same result:

    redis> RG.PYEXECUTE "GB().count().run()"