PureDevOps Community

How can I see the current size of my Redis database?

I am familiar with the info and config commands in redis-cli. The size of the present database, however, is not stated anywhere. How was I supposed to know this?

Option : 1

redis-cli info memory | grep 'used_memory.*human';

Sample output:

used_memory_human:20.66M
used_memory_rss_human:24.26M
used_memory_peak_human:46.14M
used_memory_lua_human:37.00K
used_memory_scripts_human:0B

Option:2

for listing overall information of your redis type info and to view only memory just type

INFO Memory
# Memory
used_memory:1259920
used_memory_human:1.20M
used_memory_rss:1227000
used_memory_peak:2406152
used_memory_peak_human:2.29M
used_memory_lua:36864
mem_fragmentation_ratio:0.97
mem_allocator:dlmalloc-2.8

Additionally one can use the dbsize command to get the number of keys in the database