redis内存分析工具rdbtools

rdbtools 日志分析工具,分析dump.rdb文件,以json格式导出数据
1、生成内存报告
2、转储文件到JSON
3、使用标准diff
:python语言开发


安装:pip install rdbtools
解析:rdb --command json /data/dump.rdb
只解析符合正则的keys:rdb --command json --key "sences" /data//dump.rdb
只解析hash: --type hash
生成CSV格式的内存报告:rdb -c memory /data/dump.rdb>report.csv
内容如下所示:
database,type,key,size_in_bytes,encoding,num_elements,len_largest_element
0,string,"ot_0_3b0703c01015ce05f76ef4b977dc020e820d0692",351,string,184,184
0,hash,"sences_98558",1703,hashtable,10,132
0,hash,"sences_170989",1698,hashtable,10,138
0,hash,"sences_34233",1673,hashtable,10,115

查询某个KEY使用的内存量
redis-memory-for-key -s ip keyname1

--

/usr/local/python/bin/rdb --command diff /data/redis_data/6379/dump.rdb | sort > dump1.txt

/usr/local/python/bin/rdb --command diff /data/redis_data/6379/dump.rdb | sort > dump2.txt

diff dump1.txt dump2.txt

猜你喜欢

转载自blog.csdn.net/weixin_34319999/article/details/87504147