redis分析key大小

redis分析key大小

数据倾斜
影响主从同步
影响宽带
影响性能

redis-cli --bigkeys

  • 多次遍历整个redis的所有key
  • 执行时可以利用-i参数添加休眠时间,避免占用过多资源
# 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 '"myhash1"' with 3 fields
[00.00%] Biggest string found so far '"product"' with 540 bytes

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

Sampled 3 keys in the keyspace!
Total key length in bytes is 20 (avg len 6.67)

Biggest   hash found '"myhash1"' has 3 fields
Biggest string found '"product"' has 540 bytes

0 lists with 0 items (00.00% of keys, avg size 0.00)
2 hashs with 6 fields (66.67% of keys, avg size 3.00)
1 strings with 540 bytes (33.33% of keys, avg size 540.00)
0 streams with 0 entries (00.00% of keys, avg size 0.00)
0 sets with 0 members (00.00% of keys, avg size 0.00)
0 zsets with 0 members (00.00% of keys, avg size 0.00)

使用redis-rdb-tools工具分析

  • 需要rdb文件

rdb -c memory dum.rdb > redis.csv

查看单个key

  • 不需要rdb文件

redis-memory-for-key -s b.redis -p 7379 myhash

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值