首页 > 数据库 >Redis monitor命令

Redis monitor命令

时间:2022-12-18 16:33:49浏览次数:76  
标签:127.0 monitor 60866 0.1 Redis per 命令 requests MONITOR

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

标签:127.0,monitor,60866,0.1,Redis,per,命令,requests,MONITOR
From: https://www.cnblogs.com/jinanxiaolaohu/p/16989422.html

相关文章

  • 通过docker启动redis,存在端口映射和数据卷
    先将redis.conf文件进行创建,因为如果不先创建,在redis启动的时候,/etc/redis/中本没有文件,就会将redis.conf创建为一个文件夹mkdir-p/mydata/redis/conftouch/mydata/re......
  • DockerCompose编排Redis6.2.6以及遇到的那些坑
    场景Docker中使用Dockerfile的方式部署SpringBoot+Vue前后端分离的项目(若依前后端分离框架为例):https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/12021042......
  • Redis Cluster集群分析&部署
    一、为什么使用RedisCluster集群   这里就要说到Redis集群的演变过程1.主从复制   工作模式为提供多台redis服务,选择其中的一台作为master节点向外提供读写服......
  • redis 轻松实现分布式秒杀系统
    redis轻松实现分布式秒杀系统利用redis操作的原子性,轻松实现一个分布式的秒杀系统。假设设计背景:1万人去抢10个商品设计思路:在redis中存储一个list,每次用户请求抢购......
  • linux 安装运行redis与Spring连接配置,10分钟快速入门
    linux是一方面是开源免费的,另一面其长时间运行的可靠性远高于其他系统,所以是目前国内绝大多数公司部署项目的首选。其中部署项目往往需要配套诸如Mysql、maven、redis等等......
  • Kubernetes(k8s) kubectl rollout status常用命令
    kubectl在$HOME/.kube目录中查找一个名为config的配置文件。可以通过设置KUBECONFIG环境变量或设置--kubeconfig参数来指定其它kubeconfig文件。本文主要介绍K......
  • Linux 命令 su 和 sudo 的区别
    前戏参加某大会和某个运维行业大佬聊天被问到一直没有研究过这个问题,可能一直是最高权限吧sudosudo是一种权限管理机制,依赖于/etc/sudoers,其定义了授权给哪个用户可以以管......
  • Robot Framework使用OperatingSystem内置库执行dos命令
    OperatingSystem是内置库,可以直接导入使用,不需要单独安装。***Settings***LibraryOperatingSystem***TestCases***exec_bat${ret}Operatin......
  • Linux网络命令
    目录ifconfig命令route路由命令ip命令netstat命令ping命令telnet命令ssh命令ifconfig命令用于配置网卡ip地址等网络参数信息,或者查看网络接口信息,类似于windows的ipconfi......
  • 在springboot项目里配置ReactiveRedisTemplate
    配置pom.xml: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis-reactive</artifactId> </dependency> ......