Redis-rdb-tools installation Deployment and use

Source: Internet
Author: User

Redis Memory Analysis tool redis-rdb-tools installation Deployment
Project Address: Https://github.com/sripathikrishnan/redis-rdb-tools

Installation Deployment
安装Python2.7下载redis-rdb-toolsgit clone https://github.com/sripathikrishnan/redis-rdb-tools.git安装redis-rdb-toolspip2.7 install  python-lzfcd redis-rdb-toolspython2.7 setup.py install
Common usage:
# 以json格式输出> rdb --command json /var/redis/6379/dump.rdb# 以json格式输出,模糊查找> rdb --command justkeyvals --key "user.*" /var/redis/6379/dump.rdbuser003 fname Ron,sname Bumquist,user001 fname Raoul,sname Duke,user002 fname Gonzo,sname Dr,user_list user003,user002,user001# 查找确定键信息> redis-memory-for-key -s localhost -p 6379 -a mypassword person:1Key             person:1Bytes               111Type                hashEncoding            ziplistNumber of Elements      2Length of Largest Element   8# rdb文件解析并输出为csv> rdb -c memory /var/redis/6379/dump.rdb --bytes 128 -f memory.csv> cat memory.csvdatabase,type,key,size_in_bytes,encoding,num_elements,len_largest_element0,list,lizards,241,quicklist,5,190,list,user_list,190,quicklist,3,72,hash,baloon,138,ziplist,3,112,list,armadillo,231,quicklist,5,202,hash,aroma,129,ziplist,3,11#  输出top10的键信息rdb -c memory  --largest=10  /app/redis/data/7000/dump.rdb
Error and Workaround:

In Redis-cluster mode, the user has the following error, change the address to the corresponding address of the key can be

[[email protected] python2.7]# redis-memory-for-key-s 172.16.2.53-p 7000 Keynametesttraceback (most recent call LA ST): File "/usr/local/python2.7/bin/redis-memory-for-key", line one, in <module> load_entry_point (' rdbtools==0.1 . ', ' console_scripts ', ' Redis-memory-for-key ') () File "/usr/local/python2.7/lib/python2.7/site-packages/ rdbtools-0.1.12-py2.7.egg/rdbtools/cli/redis_memory_for_key.py ", line +, in main db=options.db, password= Options.password) File "/usr/local/python2.7/lib/python2.7/site-packages/rdbtools-0.1.12-py2.7.egg/rdbtools/cli/ redis_memory_for_key.py ", line. Print_memory_for_key raw_dump = redis.execute_command (' Dump ', key) File"/usr/lo cal/python2.7/lib/python2.7/site-packages/redis/client.py ", line 668, in Execute_command return Self.parse_response ( Connection, Command_name, **options) File "/usr/local/python2.7/lib/python2.7/site-packages/redis/client.py", line 680, in Parse_response response = Connection.read_response () File "/usr/local/python2.7/lib/python2.7/site-packages/redis/connection.py ", line 629, in Read_response raise Responseredis.exceptions.ResponseError:MOVED 16278 172.16.0.99:7000[[email protected] python2.7]#                Redis-memory-for-key-s 172.16.0.99-p 7000 Keynametestkey keynametestbytes 933972.0Type Sortedsetencoding Skiplistnumber of Elements 7658Length of largest Element 8

Precautions:

1、整个rdb文件的解析会导致CPU占用严重,所以慎用!!!2、最好选择单键查询的方式,不太消耗资源3、如果需要解析某个rdb文件,最好使用它的备份文件,或者将文件导出到本地或者测试机进行解析

Redis-rdb-tools installation Deployment and use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.