codis使用redis–bigkeys分析大KEY

我们知道redis可以使用redis –bigkeys来分析大KEY,codis有也可以使用redis–bigkeys分析大KEY。

redis –bigkeys对redis中的key进行采样,寻找较大的keys。是用的是scan方式,不用担心会阻塞redis很长时间不能处理其他的请求。执行的结果可以用于分析redis的内存的只用状态,每种类型key的平均大小。

 

不要直接连接codis-Proxy地址,连也连不上的,如图:

codis1

可以连接codis-server实例的地址(redis-cli -h 127.0.0.1 -p 7001  –bigkeys),如图:

codis2

结果例子:

Sampled 3501369 keys in the keyspace!
Total key length in bytes is 67908292 (avg len 19.39)

Biggest string found ‘test_news_rec_335190’ has 5780 bytes
Biggest list found ‘user:test:list:3648988’ has 349 items
Biggest set found ‘test_day_rec_user#2016-10-26#1#1#1’ has 1159528 members
Biggest hash found ‘test_exposure_uid_1275153’ has 11644 fields
Biggest zset found ‘test_service_response_2016-05-05’ has 4 members

1986876 strings with 442973311 bytes (56.75% of keys, avg size 222.95)
432466 lists with 1570083 items (12.35% of keys, avg size 3.63)
7634 sets with 7191246 members (00.22% of keys, avg size 942.00)
1074392 hashs with 41308342 fields (30.68% of keys, avg size 38.45)
1 zsets with 4 members (00.00% of keys, avg size 4.00)

Redis 数据类型

String(字符串)
Hash(哈希)
List(列表)
Set(集合)
zset(sorted set:有序集合)

 

 

© 版权声明
THE END
喜欢就支持以下吧
点赞0 分享
图片正在生成中,请稍后...