Redis 使用 hotkeys 查看热点数据
Redis 4.0.3
中新增查看热点数据命令行,使用热点数据必须将内存策略修改为LFU
算法
查看内存策略
dc-10:0>config get maxmemory-policy
1) "maxmemory-policy"
2) "noeviction"
dc-10:0>object freq a
"ERR An LFU maxmemory policy is not selected, access frequency not tracked. Please note that when switching between policies at runtime LRU and LFU data will take some time to adjust."
设置内存策略为 LFU算法
dc-10:0>config set maxmemory-policy allkeys-lfu
"OK"
dc-10:0>object freq a
"0"
统计热点key
root@2690a5964c56:/# redis-cli --hotkeys
# Scanning the entire keyspace to find hot 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%] Hot key '"b"' found so far with counter 6
[00.00%] Hot key '"a"' found so far with counter 8
-------- summary -------
Sampled 2 keys in the keyspace!
hot key found with counter: 8 keyname: "a"
hot key found with counter: 6 keyname: "b"
今天的文章redis怎么判断热点数据_redis热点key解决方案分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/88658.html