首页 > 编程知识 正文

redis查看key对应的value,redis key大小

时间:2023-05-05 20:53:47 阅读:197868 作者:1484

mhdej一(推荐)使用rbdtools   高效

#安装rdbtools

yum -y install gcc

yum -y install epel-release

yum -y install python-pip

yum install python-devel

不安装会报错Python.h:没有那个文件或目录

pip install rdbtools

rdb -c memory  /usr/local/services/redis/dbbak/dump.rdb > /tmp/result.csv

然后把csv拿出来看就可以  也可以不输出到csv  直接打印在屏幕上

mhdej二#使用自带的工具

redis-cli -a pdabc  --bigkeys

全部结果大致如下  相比rdbtools速度很慢。

# Scanning the entire keyspace to find biggest keys as well as

# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec

# per 100 SCAN commands (not usually needed).

[00.00%] Biggest hash   found so far 's_9329222' with 3 fields

[00.00%] Biggest string found so far 'url_http://mini.eastday.com/mobile/170722090206890.html?qid=sgllq&ch=east_sogou_push&pushid=13' with 8 bytes

[00.00%] Biggest string found so far 'foo' with 40 bytes

[00.00%] Biggest hash   found so far 's_9329084' with 4 fields

[00.23%] Biggest zset   found so far 'region_hot_菏泽地' with 625 members

[00.23%] Biggest zset   found so far 'region_hot_葫芦岛' with 914 members

[00.47%] Biggest string found so far 'top_notice_list' with 135193 bytes

[00.73%] Biggest zset   found so far 'region_hot_自贡' with 2092 members

[01.90%] Biggest hash   found so far 'uno_facet_2018-12-20' with 59 fields

[11.87%] Biggest zset   found so far 'region_hot_上海' with 2233 members

[27.05%] Biggest set    found so far 'blacklist_set_key' with 31832 members

[73.87%] Biggest string found so far 'PUSH_NEWS' with 3104237 bytes

[86.18%] Biggest zset   found so far 'region_hot_北京' with 2688 members

-------- summary -------

Sampled 4263 keys in the keyspace!

Total key length in bytes is 174847 (avg len 41.02)

Biggest string found 'PUSH_NEWS' has 3104237 bytes

Biggest    set found 'blacklist_set_key' has 31832 members

Biggest   hash found 'uno_facet_2018-12-20' has 59 fields

Biggest   zset found 'region_hot_北京' has 2688 members

1616 strings with 3771161 bytes (37.91% of keys, avg size 2333.64)

0 lists with 0 items (00.00% of keys, avg size 0.00)

1 sets with 31832 members (00.02% of keys, avg size 31832.00)

2353 hashs with 7792 fields (55.20% of keys, avg size 3.31)

293 zsets with 333670 members (06.87% of keys, avg size 1138.81)

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。