redis-observability

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Redis Observability

Redis可观测性

What to watch, what to run, and what to alert on. Covers the metrics every Redis deployment should monitor and the built-in commands for ad-hoc diagnosis.
需要关注的内容、执行的命令以及告警规则。涵盖所有Redis部署都应监控的指标,以及用于临时诊断的内置命令。

When to apply

适用场景

  • Setting up monitoring or alerts for a Redis instance.
  • Diagnosing a Redis performance regression (high latency, memory pressure, connection storms).
  • Profiling a slow
    FT.SEARCH
    or pipeline.
  • Wiring Redis metrics into Prometheus, Datadog, CloudWatch, or similar.
  • 为Redis实例设置监控或告警。
  • 诊断Redis性能退化问题(高延迟、内存压力、连接风暴)。
  • 分析慢
    FT.SEARCH
    查询或管道操作。
  • 将Redis指标接入Prometheus、Datadog、CloudWatch等监控系统。

1. Monitor these metrics

1. 监控这些指标

These come from
INFO
and should be exported to your monitoring system.
MetricWhat it tells youAlert when
used_memory
Current memory usage> 80% of
maxmemory
connected_clients
Open connectionsSudden spikes or drops
blocked_clients
Clients waiting on blocking ops> 0 sustained
instantaneous_ops_per_sec
Current throughputSignificant drops
keyspace_hits
/
keyspace_misses
Cache hit ratioHit ratio < 80%
rejected_connections
Hit
maxclients
cap
> 0
rdb_last_save_time
Last persistence snapshotToo old vs. RPO
python
info = redis.info()
hit_ratio = info["keyspace_hits"] / max(1, info["keyspace_hits"] + info["keyspace_misses"])
print(f"Memory:    {info['used_memory_human']}")
print(f"Clients:   {info['connected_clients']}")
print(f"Ops/sec:   {info['instantaneous_ops_per_sec']}")
print(f"Hit ratio: {hit_ratio:.1%}")
See references/metrics.md.
这些指标来自
INFO
命令,应导出到你的监控系统中。
指标说明告警条件
used_memory
当前内存使用量超过
maxmemory
的80%
connected_clients
活跃连接数出现突然的激增或骤降
blocked_clients
等待阻塞操作的客户端数持续大于0
instantaneous_ops_per_sec
当前吞吐量出现显著下降
keyspace_hits
/
keyspace_misses
缓存命中率命中率低于80%
rejected_connections
达到
maxclients
上限的拒绝连接数
大于0
rdb_last_save_time
最后一次持久化快照时间与恢复点目标(RPO)相比过于陈旧
python
info = redis.info()
hit_ratio = info["keyspace_hits"] / max(1, info["keyspace_hits"] + info["keyspace_misses"])
print(f"Memory:    {info['used_memory_human']}")
print(f"Clients:   {info['connected_clients']}")
print(f"Ops/sec:   {info['instantaneous_ops_per_sec']}")
print(f"Hit ratio: {hit_ratio:.1%}")
查看references/metrics.md

2. Built-in commands for debugging

2. 用于调试的内置命令

Reach for these when something looks off.
TopicCommand
Slow commands
SLOWLOG GET 10
/
SLOWLOG LEN
/
SLOWLOG RESET
Server snapshot
INFO all
(or
INFO memory
/
INFO stats
/
INFO clients
/
INFO replication
)
Memory diagnostics
MEMORY DOCTOR
/
MEMORY STATS
/
MEMORY USAGE <key>
Connections
CLIENT LIST
/
CLIENT INFO
RQE / Search
FT.INFO <idx>
/
FT.PROFILE <idx> SEARCH QUERY "..."
The two most useful for incident triage:
  • SLOWLOG GET
    to find queries that exceeded the
    slowlog-log-slower-than
    threshold (10ms by default). The output shows the exact command and duration in microseconds.
  • MEMORY DOCTOR
    for memory pressure — it returns a one-paragraph summary of what's unusual about memory usage right now.
python
for entry in redis.slowlog_get(10):
    print(f"{entry['duration']}μs  {entry['command']}")
See references/commands.md.
当出现异常时,可以使用这些命令。
主题命令
慢命令
SLOWLOG GET 10
/
SLOWLOG LEN
/
SLOWLOG RESET
服务器快照
INFO all
(或
INFO memory
/
INFO stats
/
INFO clients
/
INFO replication
内存诊断
MEMORY DOCTOR
/
MEMORY STATS
/
MEMORY USAGE <key>
连接管理
CLIENT LIST
/
CLIENT INFO
RQE/搜索
FT.INFO <idx>
/
FT.PROFILE <idx> SEARCH QUERY "..."
事件排查中最有用的两个命令:
  • SLOWLOG GET
    :用于查找超过
    slowlog-log-slower-than
    阈值(默认10毫秒)的查询。输出会显示具体命令和执行时长(微秒)。
  • MEMORY DOCTOR
    :用于排查内存压力问题——它会返回一段关于当前内存使用异常情况的总结。
python
for entry in redis.slowlog_get(10):
    print(f"{entry['duration']}μs  {entry['command']}")
查看references/commands.md

3. Redis Insight

3. Redis Insight

For interactive use (running queries, browsing keys, profiling indexes), Redis Insight is the official GUI. It surfaces the same
SLOWLOG
/
INFO
/
FT.PROFILE
data visually and includes Redis Copilot for natural-language queries. Useful during development and incident response; not a replacement for exporting metrics to your monitoring system.
对于交互式操作(执行查询、浏览键、分析索引),Redis Insight是官方GUI工具。它以可视化方式展示
SLOWLOG
/
INFO
/
FT.PROFILE
的数据,还包含支持自然语言查询的Redis Copilot。适用于开发和事件响应阶段,但不能替代将指标导出到监控系统的操作。

References

参考资料