1.slowlog get 慢日志
redis-cli -h localhost -p 4528 -n 8
slowlog get
1. 命令id
2. 时间戳
3. 执行时间 us
4. cmd
5. 客户端ip:port
6. 客户端名称2.redis-benchmark 计算qps
redis-benchmark -h localhost -p 4528 -c 50 -n 100000 -q
SET: 196463.66 requests per second, p50=0.119 msec
1. cmd: SET
2. qps: 196463.66
3. p50: 有%50的请求的响应时间小于0.119ms3.MONITOR 监控
redis-cli -h localhost -p 4528 -n 5 # MONITOR监控的是这个实例执行的所有命令
MONITORredis-cli -h localhost -p 4528 MONITOR | grep '"LPOP"' | grep 'key' # 加过滤
1746511773.035725 [8 192.168.6.16:41806] "LINDEX" "slots100186_normal_matrix_0" "1829"
1. 时间戳: 1746511773.035725
2. 数据库编号: 8
3. 客户端信息: ip:port 192.168.6.16:41806
4. [4,+∞] cmd4.commandstats 命令耗时统计
redis-cli -h localhost -p 4528 -n 5 INFO commandstats # 统计redis实例从启动到现在的命令耗时
cmdstat_sadd:calls=200093,usec=86472,usec_per_call=0.43,rejected_calls=0,failed_calls=0
1. cmd: cmdstat_sadd
2. 调用次数: 200093
3. 总耗时: 86472us
4. 平均耗时: 0.43us
5. 被拒次数: 0
6. 出错次数: 05.bigkeys 大键
redis-cli -h localhost -p 4528 -n 6 --bigkeys -i 0.1
# -i 防止阻塞 scan会间隔0.1s
1. [00.35%] [00.40%] [00.49%] # 这个是扫描的进度条
2. Sampled 46048 keys in the keyspace # 总扫描46048个key 注:scan并不能保证扫描了所有的key
3. Total key length in bytes is 1368398 (avg len 29.72) # 总1368398个字节/1024/1024≈1.31MB
4. 46044 lists with 178037 items (99.99% of keys, avg size 3.87) # 46044个list总元素个数1780376.client list 客户端状态
redis-cli -h localhost -p 4528 -n 6 client list
1. 查看所有连接的信息,在连接过多的时候频繁执行可能阻塞redis
2.文档更新时间: 2026-04-17 16:41 作者:morninglu
