redis-rdb-tools analyze reids dump

 

redis-rdb-tools is a tool that analyzes rdb files and is often very helpful in locating problems.

Install redis-rdb-tools

 

git clone https://github.com/sripathikrishnan/redis-rdb-tools
cd redis-rdb-tools
sudo python setup.py install
 

 

Analyze whether there is a larger value

 

redis-cli -p 6379 bgsave
sudo sh -c 'rdb -c memory dump.rdb > memory.csv'
sort -t, -k4nr memory.csv |more

 

 

 

 

 

SQL flexible analysis

    SQLite is a lightweight database. We import cvs data into the database for flexible analysis. Almost all versions of Linux operating systems come with SQLite.

 

[[email protected]]$sqlite3  redis.db
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq  name             file  
---  ---------------  ----------------------------------------------------------
0    main             /opt/test/redis.db 
sqlite> create table redis(database int,type varchar(128),key varchar(128),size_in_bytes int,encoding varchar(128),num_elements int,len_largest_element varchar(128));
sqlite> .mode csv redis
sqlite> .import memory.csv redis

analyze

 

select count(*) from redis;
select sum(size_in_bytes) from redis;
select * from redis order by size_in_bytes desc limit 20;
select * from redis where type='list' and num_elements > 200 ;

 

 

 

https://github.com/sripathikrishnan/redis-rdb-tools

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327041465&siteId=291194637