In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Redis memory Analysis tool redis-rdb-tools installation and deployment
Project address: https://github.com/sripathikrishnan/redis-rdb-tools
Install deployment install Python2.7 download redis-rdb-toolsgit clone https://github.com/sripathikrishnan/redis-rdb-tools.git install redis-rdb-toolspip2.7 install python-lzfcd redis-rdb-toolspython2.7 setup.py install common usage: # output in json format > rdb--command json / var/redis/6379/dump.rdb# export in json format Fuzzy search > 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# search determines key information > redis-memory-for-key-s localhost-p 6379-a mypassword person:1Key person:1Bytes 111Type hashEncoding ziplistNumber of Elements 2Length of Largest Element keys rdb file parses and outputs as 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# outputs the key information of top10 rdb-c memory-- largest=10 / app/redis/data/7000/dump.rdb error report and solution:
If you make the following error in redis-cluster mode, change the address to the address corresponding to the key.
[root@TEST python2.7] # redis-memory-for-key-s 172.16.2.53-p 7000 KEYNAMETESTTraceback (most recent call last): File "/ usr/local/python2.7/bin/redis-memory-for-key", line 11, in load_entry_point ('rdbtools==0.1.12',' 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 43, 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 53 In print_memory_for_key raw_dump = redis.execute_command ('dump', key) File "/ usr/local/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 KEYNAMETESTKey KEYNAMETESTBytes 933972.0Type sortedsetEncoding skiplistNumber of Elements 7658Length of Largest Element 7000 [root@TEST 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
Note:
1. The parsing of the entire rdb file will lead to a serious occupation of CPU, so use it carefully! 2. It is best to choose the method of single-button query, which does not consume much resources. 3. If you need to parse a rdb file, it is best to use its backup file, or export the file to the local or test machine for parsing
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.