How to Monitor Redis with Prometheus: Installation, Configuration, Visualization, and Alerting
This article explains how to set up Redis monitoring using Prometheus, covering installation of Redis Exporter, Prometheus configuration, Grafana visualization, and alert rule creation, providing step‑by‑step commands and guidance to ensure high availability and performance of Redis instances.
In modern application architectures, Redis is widely used as a high‑performance cache and message queue, and monitoring its availability and stability is essential.
While basic tools like redis‑cli and redis‑stat provide limited metrics, a more powerful solution is to use Prometheus together with the Redis Exporter.
1. Install Redis Exporter
$ wget https://github.com/oliver006/redis_exporter/releases/download/v1.36.0/redis_exporter-v1.36.0.linux-amd64.tar.gz
$ tar -xvf redis_exporter-v1.36.0.linux-amd64.tar.gz
$ cd redis_exporter-v1.36.0.linux-amd64/
$ mv redis_exporter /usr/local/bin/Start the exporter:
$ redis_exporter -redis.addr localhost:6379 &The exporter exposes metrics on port 9121 for Prometheus to scrape.
2. Configure Prometheus
scrape_configs:
- job_name: 'redis'
scrape_interval: 5s
static_configs:
- targets: ['192.168.214.112:9121']Run Prometheus with the updated configuration:
$ prometheus --config.file /etc/prometheus/prometheus.yml &After Prometheus reloads, the Redis job will be active.
3. Data Visualization with Grafana
Add Prometheus as a data source in Grafana, import a Redis dashboard template, and create panels to display metrics such as memory usage, command execution, client connections, and persistence status.
4. Alerting
groups:
- name: redis_alerts
rules:
- alert: TooManyConnections
expr: redis_connected_clients > 1000
for: 5m
labels:
severity: warning
annotations:
summary: "Too many connections (instance {{ $labels.instance }})"
description: "Redis instance has too many connections
VALUE = {{ $value }}
LABELS: {{ $labels }}"This rule triggers a warning when client connections exceed 1000, helping operators respond quickly.
By combining Prometheus, Redis Exporter, and Grafana, you can build a reliable monitoring and alerting system that ensures Redis’s availability and performance.
DevOps Operations Practice
We share professional insights on cloud-native, DevOps & operations, Kubernetes, observability & monitoring, and Linux systems.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.