监控 redis 执行命令
监控 redis 执行命令
Intro
最近在用 redis 的时候想看看执行了哪些命令,于是发现了 redis-cli 提供的 Monitor 命令,直接使用这个就可以监控执行的大部分 redis 命令,之所以说是大部分,是因为有一些命令如:config 出于安全原因是不会记录的。
Monitor 是调试用的命令
Redis-cli
使用redis-cli连接到redis服务器
redis-cli -h [redis server ip/host] -p [redis server port] [-a accessKey]
之后执行 monitor 命令
$ 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] "del" "x"
1339518100.544926 [0 127.0.0.1:60866] "get" "x"
使用 Ctrl+C 退出 monitor
Telnet
使用 telnet 连接 redis服务器,而后执行 monitor
$ 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.
使用 Quit 命令来退出 monitor
性能消耗
由于 MONITOR 命令返回 服务器处理的所有的 命令, 所以在性能上会有一些消耗.
在不运行 MONITOR 命令的情况下,benchmark的测试结果:
$ 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
运行 MONITOR 命令的情况下,benchmark 的测试结果:
$ 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
在这种特定的情况下,运行一个 MONITOR 命令能够降低50%的吞吐量
所以,如果不是特别需要不推荐使用 Monitor 这个命令,仅供开发过程中的调试。
Reference
- https://redis.io/commands/MONITOR
- http://redis.cn/commands/monitor.html
- https://blog.serverdensity.com/monitor-redis/
监控 redis 执行命令的更多相关文章
- Redis监控工具,命令和调优
Redis监控工具,命令和调优 1.图形化监控 因为要对Redis做性能测试,发现了GitHub上有个python写的RedisLive监控工具评价不错.结果鼓捣了半天,最后发现其主页中引用了Goog ...
- Redis常用命令
Redis常用命令Redis提供了丰富的命令对数据库和各种数据类型进行操作,这些命令可以再Linux终端使用.1.键值相关命令2.服务器相关命令 一.键值相关命令 1.get get 键值 当 key ...
- 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 ...
- 【Azure Redis 缓存】Azure Redis出现了超时问题后,记录一步一步的排查出异常的客户端连接和所执行命令的步骤
问题描述 Azure Redis在使用的过程中,多次无规律的出现超时问题.抓取到客户端的异常错误后,想进一步的分析是何原因导致了如下异常呢? Timeout awaiting response (ou ...
- 使用控制台对Redis执行增删改查命令
使用控制台对Redis执行增删改查命令 在上一篇里,我们已经安装了redis.这一篇我们将一起来学习如何使用"控制台"管理Redis 首先肯定是打开一个控制台,在windows系统 ...
- zabbix自定义监控项、添加图形、设置触发器、远程执行命令
监控项是在zabbix中手机数据的基础,没有监控项就没有数据,系统自带模板带有大量默认item,自定义item可以定义在模板中,在应用模板即可使用对应item:也可直接在host中定义 目标:自定义监 ...
- Redis中的执行命令的过程
在redis.c的initServerConfig()方法中,通过调用dictCreate方法初始化server端的命令表.这个命令表是一个hashtable,可以通过key找到相关的命令: /* C ...
- Zabbix日常监控(触发器表达式、远程执行命令、宏简等)简单记录
主机的工作基本流程 Host group --> Host --> Application --> Item --> Trigger(OK-->PROBLEM,trigg ...
- redis客户端执行命令没反应
问题:redis-cli连接客户端后,执行命令没有反应 解决方法:通过指定一个开启守护进程的配置文件来启动服务,redis-server ../redis.conf 说明:redis.conf是我 ...
随机推荐
- [Swift]LeetCode205. 同构字符串 | Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the chara ...
- [Swift]LeetCode220. 存在重复元素 III | Contains Duplicate III
Given an array of integers, find out whether there are two distinct indices i and j in the array suc ...
- [Swift]LeetCode493. 翻转对 | Reverse Pairs
Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j] ...
- [Swift]LeetCode765. 情侣牵手 | Couples Holding Hands
N couples sit in 2N seats arranged in a row and want to hold hands. We want to know the minimum numb ...
- [Swift]LeetCode972.相等的有理数 | Equal Rational Numbers
Given two strings S and T, each of which represents a non-negative rational number, return True if a ...
- VMware Workstation下安装Linux
下载VMware Workstation thunder://QUFodHRwczovL2Rvd25sb2FkMy52bXdhcmUuY29tL3NvZnR3YXJlL3drc3QvZmlsZS9WT ...
- Python内置函数(18)——enumerate
英文文档: enumerate(iterable, start=0) Return an enumerate object. iterable must be a sequence, an itera ...
- 软件工程-构建之法 小学生四则运算的出题程序,android版本
内容中包含 base64string 图片造成字符过多,拒绝显示
- JDK1.8源码(三)——java.util.HashMap
什么是哈希表? 在讨论哈希表之前,我们先大概了解下其他数据结构在新增,查找等基础操作执行性能 数组:采用一段连续的存储单元来存储数据.对于指定下标的查找,时间复杂度为O(1):通过给定值进行查找, ...
- Java提高班(五)深入理解BIO、NIO、AIO
导读:本文你将获取到:同/异步 + 阻/非阻塞的性能区别:BIO.NIO.AIO 的区别:理解和实现 NIO 操作 Socket 时的多路复用:同时掌握 IO 最底层最核心的操作技巧. BIO.NIO ...