Search code examples
redisredis-clusterredis-cli

Redis - Get total dataset size in a cluster


When a Redis instance is setup and running, the dataset size (in bytes) can be retrieved from output of the below command by looking at used_memory_dataset field.

./redis-cli -h <ip address> -p <port> info

However, when I have multiple instances running in the cluster mode, how do I retrieve the dataset size across the cluster? Can redis-cli tool still be used for such cluster-based commands?


Solution

  • As of Redis v5 the cli includes cluster-smarts. You can use the following form to call a command, e.g. INFO, on all nodes:

    redis-cli --cluster call ip:port command
    

    To calculate the dataset's total size, you'd have to add up the different replies.