标签:primary 头信息 rip cli dump element min tools into
https://github.com/sripathikrishnan/redis-rdb-tools/releases
https://pypi.org/project/python-lzf/
https://pypi.python.org/simple/redis/
pip install python-lzf-0.2.4.tar.gz
pip install redis-2.10.6.tar.gz
pip install rdbtools-0.1.12.tar.gz
建议放在其他测试环境执行,避免对生产主机的资源有影响
通过一下模拟一些大key
cat /root/test.txt | /dbdata/redis/app1/redis4010/bin/redis-cli -h 5.5.5.102 -p 6379 -a abc123 --pipe
cat /root/test2.txt | /dbdata/redis/app1/redis4010/bin/redis-cli -h 5.5.5.102 -p 6379 -a abc123 --pipe
rdb.py -c memory /dbdata/dumpdir/dump.rdb > /dbdata/dumpdir/memory.csv
sed -i ‘1d‘ memory.csv
即(database,type,key,size_in_bytes,encoding,num_elements,len_largest_element)
CREATE TABLE memory
(database
int(128) DEFAULT NULL,type
varchar(128) DEFAULT NULL,KEY
varchar(128) not NULL,size_in_bytes
bigint(20) DEFAULT NULL,encoding
varchar(128) DEFAULT NULL,num_elements
bigint(20) DEFAULT NULL,len_largest_element
varchar(128) DEFAULT NULL,
PRIMARY KEY (KEY
));
load data infile ‘/dbdata/dumpdir/memory.csv‘
into table memory
fields terminated by ‘,‘ optionally enclosed by ‘"‘ escaped by ‘"‘
lines terminated by ‘\n‘;
select * from memory order by size_in_bytes desc limit N;
标签:primary 头信息 rip cli dump element min tools into
原文地址:https://www.cnblogs.com/imdba/p/10116500.html