redis慢日志提取和分析

4680阅读 0评论2017-01-12 dbwatcher
分类:NOSQL

博客文章除注明转载外,均为原创。转载请注明出处。
本文链接地址:http://blog.chinaunix.net/uid-31396856-id-585023.html


redis慢日志的提取和分析有很多种方法:
1.使用命令解析
(1)配置参数
CONFIG SET slowlog-log-slower-than 1000 大于1000微秒的查询记录
CONFIG SET slowlog-max-len 100 保留100条日志

(2)slowlog get (n)
127.0.0.1:6379> slowlog get
1) 1) (integer) 0
   2) (integer) 1484202752
   3) (integer) 926
   4) 1) "set"
      2) "mykey"
      3) "this is a test"

2.使用工具vc-redis-sniffer,从redis中抓取慢日志。



开始抓取Redis的慢日志
[root@redis /opt/vc-redis-sniffer]
# ./vc-redis-sniffer -binding="[::]:6379"  -output="/tmp/redis.log"

然后,我们使用pt-query-digest来格式化redis的日志,如下:


这个效果,MySQL DBA都熟悉:)

--The End

上一篇: MySQL 5.7组复制实践2-single master模式
下一篇:MySQL存储引擎-TokuDB的安装配置说明