Now occasionally found in Redis some key value has dozens of MB, this is abnormal data, there is no way to sort by value size list more than 10MB all key?
Reply content:
Now occasionally found in Redis some key value has dozens of MB, this is abnormal data, there is no way to sort by value size list more than 10MB all key?
Find you a tool that has been tested for use: Https://github.com/sripathikrishnan/redis-rdb-tools#generate-memory-report
The installation and use method is written on the document, and if an RDB command is not found on the installation, it can be executed directly in the installation directory:
rdbtools/cli/rdb.py -c memory /path/to/your/dump.rdb > result.csv
Database |
type |
Key |
size_in_bytes |
encoding |
num_elements |
len_largest_element |
0 |
String |
"CCCC" |
98 |
String |
4 |
4 |
0 |
String |
"BBB" |
96 |
String |
3 |
3 |
0 |
Hash |
"User" |
102 |
Ziplist |
1 |
6 |
0 |
String |
"AA" |
94 |
String |
2 |
2 |
The sizeinbytes in the result column is the size you want, and you can order it after you export it. Also, be careful to modify your own Dump.rdb file path. I haven't tested the volume of data too much, and the analysis is expected to be slower.