MONITOR

Syntax
MONITOR
Available since:
1.0.0
Time complexity:
ACL categories:
@admin@slow@dangerous

MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database. This command can both be used via redis-cli and via telnet.

The ability to see all the requests processed by the server is useful in order to spot bugs in an application both when using Redis as a database and as a distributed caching system.

$ redis-cli monitor
1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
1339518087.877697 [0 127.0.0.1:60866] "dbsize"
1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
1339518096.506257 [0 127.0.0.1:60866] "get" "x"
1339518099.363765 [0 127.0.0.1:60866] "eval" "return redis.call('set','x','7')" "0"
1339518100.363799 [0 lua] "set" "x" "7"
1339518100.544926 [0 127.0.0.1:60866] "del" "x"

Use SIGINT (Ctrl-C) to stop a MONITOR stream running via redis-cli.

$ telnet localhost 6379
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
MONITOR
+OK
+1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
+1339518087.877697 [0 127.0.0.1:60866] "dbsize"
+1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
+1339518096.506257 [0 127.0.0.1:60866] "get" "x"
+1339518099.363765 [0 127.0.0.1:60866] "del" "x"
+1339518100.544926 [0 127.0.0.1:60866] "get" "x"
QUIT
+OK
Connection closed by foreign host.

Manually issue the QUIT or RESET commands to stop a MONITOR stream running via telnet.

Commands not logged by MONITOR

Because of security concerns, no administrative commands are logged by MONITOR's output and sensitive data is redacted in the command AUTH.

Furthermore, the command QUIT is also not logged.

Cost of running MONITOR

Because MONITOR streams back all commands, its use comes at a cost. The following (totally unscientific) benchmark numbers illustrate what the cost of running MONITOR can be.

Benchmark result without MONITOR running:

$ src/redis-benchmark -c 10 -n 100000 -q
PING_INLINE: 101936.80 requests per second
PING_BULK: 102880.66 requests per second
SET: 95419.85 requests per second
GET: 104275.29 requests per second
INCR: 93283.58 requests per second

Benchmark result with MONITOR running (redis-cli monitor > /dev/null):

$ src/redis-benchmark -c 10 -n 100000 -q
PING_INLINE: 58479.53 requests per second
PING_BULK: 59136.61 requests per second
SET: 41823.50 requests per second
GET: 45330.91 requests per second
INCR: 41771.09 requests per second

In this particular case, running a single MONITOR client can reduce the throughput by more than 50%. Running more MONITOR clients will reduce throughput even more.

Return

Non standard return value, just dumps the received commands in an infinite flow.

Behavior change history

Redis monitor命令的更多相关文章

  1. 通过redis的monitor命令排除故障

    项目里有10台服务器都在一个刀箱里,其中一台是redis缓存服务器,另外的是app服务器.通过监控发现这个刀箱的流量750M,其中缓存服务器的流量达105M,这么高的流量已经造成其它项目的服务器网络延 ...

  2. Redis常用命令解析——INFO, MONITOR, SLOWLOG

    1. INFO info指令返回服务器相关信息,包括: server: General information about the Redis server clients: Client conne ...

  3. Benchmark result without MONITOR running: Benchmark result with MONITOR running (redis-cli monitor > /dev/null): 吞吐量 下降约1半 Redis监控工具,命令和调优

    https://redis.io/commands/monitor In this particular case, running a single MONITOR client can reduc ...

  4. redis shell命令大全

    redis shell命令大全(转自http://blog.mkfree.com/posts/5105432f975ad0eb7d135964) 作者:oyhk   2013-1-28 3:11:35 ...

  5. Redis常用命令手册:服务器相关命令

    Redis提供了丰富的命令(command)对数据库和各种数据类型进行操作,这些command可以在Linux终端使用.在编程时,比如各类语言包,这些命令都有对应的方法.下面将Redis提供的命令做一 ...

  6. Redis监控工具,命令和调优

    Redis监控工具,命令和调优 1.图形化监控 因为要对Redis做性能测试,发现了GitHub上有个python写的RedisLive监控工具评价不错.结果鼓捣了半天,最后发现其主页中引用了Goog ...

  7. 数据库 【redis】 命令大全

    以下纯属搬砖,我用Python抓取的redis命令列表页内容 如果想看命令的具体使用可查去官网查看,以下整理为个人查找方便而已 地理位置GEOADD 将指定的地理空间位置(纬度.经度.名称)添加到指定 ...

  8. 监控 redis 执行命令

    监控 redis 执行命令 Intro 最近在用 redis 的时候想看看执行了哪些命令,于是发现了 redis-cli 提供的 Monitor 命令,直接使用这个就可以监控执行的大部分 redis ...

  9. Redis 基础命令

    1. 进入redis目录,启动redis cd src ./redis-server 2.  进入redis目录,启动redis客户端 cd src ./redis-cli 3. info命令 4. ...

  10. redis 的命令总结

    此博客为技术收集和个人的学习积累,如侵犯了您的权益,请联系我,我会及时删除,谢谢 [Redis] redis-cli 命令总结 Redis提供了丰富的命令(command)对数据库和各种数据类型进行操 ...

随机推荐

  1. 大数据实践解析(下):Spark的读写流程分析

    导读: 众所周知,在大数据/数据库领域,数据的存储格式直接影响着系统的读写性能.spark是一种基于内存的快速.通用.可扩展的大数据计算引擎,适用于新时代的数据处理场景.在"大数据实践解析( ...

  2. Scrum Master需要具备哪些能力和经验

    摘要:ScrumMaster对于产品负责人和开发团队来说,履行的是教练的职责,帮助团队和组织其他成员发展具有组织特色的.高效的Scrum方法,贯彻执行敏捷思想,激励团队持续提升,并不懈追求卓越的表现. ...

  3. 如何对APP进行安全加固

    ​ 如何对APP进行安全加固 引言 如今,移动应用市场蓬勃发展,APP数量呈现爆炸性增长.随着5G技术的广泛应用,APP的增长趋势持续增强.然而,由于APP的泛滥,网络攻击者的目标也在逐渐转移,数亿的 ...

  4. ​HTML代码混淆技术:原理、应用和实现方法详解

    ​ HTML代码混淆是一种常用的反爬虫技术,它可以有效地防止爬虫对网站数据的抓取.本文将详细介绍HTML代码混淆技术的原理.应用以及实现方法,帮助大家更好地了解和运用这一技术. 一.HTML代码混淆的 ...

  5. .NET Core 在其上下文中,该请求的地址无效。

    .NET Core 在其上下文中,该请求的地址无效. 看了端口,发现没被占用,后来发现是IP地址变了 改成正确的IP就可以了.

  6. PPT 配色方法

    https://www.bilibili.com/video/BV1ha411g7f5/?p=10 https://dribbble.com/ 问题1:配色太多,主题色混乱 一个主色,两辅色 问题2: ...

  7. Jenkins Pipeline 流水线 - 拉代码(SVN) + Maven 编译打包

    Jenkins Pipeline 流水线 步骤 拉取SVN代码 -> Maven 构建 -> Docker 编译 -> 发布至阿里云仓库 -> K8S 更新 Jenkins插件 ...

  8. 更省更快,如何使用 Serverless 搭建个人专属网盘?

    作者| 西流 阿里云 Serverless 技术专家 1分钟 Serverless 部署个人网盘,赠好礼 随着全球大数据不断增长,未来数据云存储容量需求也将不断扩大,iiMedia Research( ...

  9. C#开源跨平台的多功能Steam工具箱

    前言 作为一名程序员你是否会经常会遇到GitHub无法访问(如下无法访问图片),或者是访问和下载源码时十分缓慢就像乌龟爬行一般.今天分享一款C#开源的.跨平台的多功能Steam工具箱和GitHub加速 ...

  10. jQuery组织后续事件 事件冒泡 事件委托 键被按下 批量操作 hover input 事件

    1. jQuery绑定事件的方式 1. $('').click(function(){}) 2. $('').on('click', function(){}) 2. 阻止后续事件执行 1. retu ...