美文网首页OpsDev
3 redis 监控命令-slowlog

3 redis 监控命令-slowlog

作者: 降水 | 来源:发表于2019-08-12 20:45 被阅读29次

redis 监控命令

  • monitor : 实时监控redis服务收到来自应用的所有命令
  • slowlog : 查看redis慢日志
  • info : 查看redis服务的各项状态
  • info CPU : cpu使用情况
  • info Keyspace: 各个db的key的状况,是否有设置超时时间。这是一个很重要的查看项
  • info Stats : 服务状态

slowlog
This command is used in order to read and reset the Redis slow queries log.
Slow log 是 Redis 用来记录查询执行时间的日志系统。

查询执行时间指的是不包括像客户端响应(talking)、发送回复等 IO 操作,而单单是执行一个查询命令所耗费的时间。

slowlog 保存在内存里面,读写速度非常快,不必担心因为开启 slow log 而损害 Redis 的速度。

1 两个配置参数:slowlog-log-slower-thanslowlog-max-len

slowlog-log-slower-than
决定要对执行时间大于多少微秒(microsecond,1秒 = 1,000,000 微秒)的查询进行记录。

slowlog-max-len
决定 slow log 最多能保存多少条日志, slow log 本身是一个 FIFO 队列,当队列大小超过 slowlog-max-len 时,最旧的一条日志将被删除,而最新的一条日志加入到 slow log。

2 两种配置方式 redis.conf 文件CONFIG SET命令

redis.conf

# The following time is expressed in microseconds, so 1000000 is equivalent
# to one second. Note that a negative number disables the slow log, while
# a value of zero forces the logging of every command.
slowlog-log-slower-than 1000

# There is no limit to this length. Just be aware that it will consume memory.
# You can reclaim memory used by the slow log with SLOWLOG RESET.
slowlog-max-len 100

CONFIG SET命令

CONFIG SET slowlog-log-slower-than 1000  //所有查询时间大于 1000 微秒的查询
CONFIG SET slowlog-max-len 1000          //slow log 最多保存 1000 条日志
3 查询慢操作
SLOWLOG GET         //慢查询日志所有记录
SLOWLOG GET 3       //慢查询日志前3条记录
SLOWLOG LEN         //慢查询日志记录数目
4 参考

相关文章

  • 3 redis 监控命令-slowlog

    redis 监控命令 monitor : 实时监控redis服务收到来自应用的所有命令 slowlog : 查看...

  • 4 redis 监控命令-info

    redis 监控命令 monitor : 实时监控redis服务收到来自应用的所有命令 slowlog : 查看...

  • 1 redis 监控命令

    redis 监控命令 monitor : 实时监控redis服务收到来自应用的所有命令 slowlog : 查看...

  • 2 redis 监控命令-monitor

    redis 监控命令 monitor : 实时监控redis服务收到来自应用的所有命令 slowlog : 查看...

  • redis慢查询

    redis.conf设置 在redis.conf中有关于slowlog的设置: 其中slowlog-log-slo...

  • 【redis】通过elasticsearch和rsbeat实时分

    参考 rsbeat,redis slowlog analyzer by elastic stack https:/...

  • 慢查询分析

    Redis 使用一个列表来存储慢查询日志 其中,所谓的慢查询,命令执行时间超过 slowlog-log-slowe...

  • 监控 redis 执行命令

    监控 redis 执行命令 Intro 最近在用 redis 的时候想看看执行了哪些命令,于是发现了 redis-...

  • Redis、Memcached状态的监控

    Redis状态监控 Redis可以使用INFO命令,进行状态监控。 通过给定可选的参数 section ,可以让命...

  • redis 查看slowlog

    查看slowlog 获取 slow log 的长度 重置 slowlog,一旦删除 slowlog 不可恢复

网友评论

    本文标题:3 redis 监控命令-slowlog

    本文链接:https://www.haomeiwen.com/subject/pyypjctx.html