Chinaunix首页 | 论坛 | 博客
  • 博客访问: 763415
  • 博文数量: 99
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1163
  • 用 户 组: 普通用户
  • 注册时间: 2016-09-22 09:50
个人简介

一个守望数据库的老菜鸟

文章分类

全部博文(99)

文章存档

2019年(21)

2018年(17)

2017年(37)

2016年(24)

我的朋友

分类: NOSQL

2017-01-12 17:54:54

博客文章除注明转载外,均为原创。转载请注明出处。
本文链接地址: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

阅读(4682) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~