真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

redis-rdb-tools安裝部署及使用

redis內(nèi)存分析工具redis-rdb-tools安裝部署
項(xiàng)目地址:https://github.com/sripathikrishnan/redis-rdb-tools

成都創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),濟(jì)寧企業(yè)網(wǎng)站建設(shè),濟(jì)寧品牌網(wǎng)站建設(shè),網(wǎng)站定制,濟(jì)寧網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,濟(jì)寧網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M(mǎn)足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。


安裝部署
安裝Python2.7
下載redis-rdb-tools
git clone https://github.com/sripathikrishnan/redis-rdb-tools.git
安裝redis-rdb-tools
pip2.7 install  python-lzf
cd redis-rdb-tools
python2.7 setup.py install
常見(jiàn)用法:
# 以json格式輸出
> rdb --command json /var/redis/6379/dump.rdb

# 以json格式輸出,模糊查找
> rdb --command justkeyvals --key "user.*" /var/redis/6379/dump.rdb

user003 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:1

Key             person:1
Bytes               111
Type                hash
Encoding            ziplist
Number of Elements      2
Length of Largest Element   8

# rdb文件解析并輸出為csv
> rdb -c memory /var/redis/6379/dump.rdb --bytes 128 -f memory.csv
> cat memory.csv

database,type,key,size_in_bytes,encoding,num_elements,len_largest_element
0,list,lizards,241,quicklist,5,19
0,list,user_list,190,quicklist,3,7
2,hash,baloon,138,ziplist,3,11
2,list,armadillo,231,quicklist,5,20
2,hash,aroma,129,ziplist,3,11

#  輸出top10的鍵信息
rdb -c memory  --largest=10  /app/redis/data/7000/dump.rdb
報(bào)錯(cuò)及解決方法:

在redis-cluster模式下使用戶(hù)出現(xiàn)如下報(bào)錯(cuò),將地址改為該鍵對(duì)應(yīng)的地址即可

[root@TEST python2.7]# redis-memory-for-key -s 172.16.2.53 -p 7000 KEYNAMETEST
Traceback (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 response
redis.exceptions.ResponseError: MOVED 16278 172.16.0.99:7000
[root@TEST python2.7]# redis-memory-for-key -s 172.16.0.99 -p 7000 KEYNAMETEST
Key             KEYNAMETEST
Bytes               933972.0
Type                sortedset
Encoding            skiplist
Number of Elements      7658
Length of Largest Element   8

注意事項(xiàng):

1、整個(gè)rdb文件的解析會(huì)導(dǎo)致CPU占用嚴(yán)重,所以慎用?。?!
2、最好選擇單鍵查詢(xún)的方式,不太消耗資源
3、如果需要解析某個(gè)rdb文件,最好使用它的備份文件,或者將文件導(dǎo)出到本地或者測(cè)試機(jī)進(jìn)行解析

標(biāo)題名稱(chēng):redis-rdb-tools安裝部署及使用
本文URL:http://weahome.cn/article/gijsjo.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部