How to Monitor Redis with Prometheus and Grafana: Step-by-Step Guide
Learn how to set up Prometheus and Grafana to monitor Redis instances by installing the redis_exporter plugin, configuring Prometheus scrape jobs, handling build issues, and visualizing metrics with ready-made Grafana dashboards, all illustrated with code snippets and configuration examples.
In the previous article we introduced Prometheus architecture and principles; this article demonstrates a hands‑on setup using Prometheus and Grafana to monitor Redis.
Download the redis_exporter plugin
The official project does not provide a dedicated exporter, but a community version is available on GitHub:
https://github.com/oliver006/redis_exporter
Installation steps
git clone https://github.com/oliver006/redis_exporter.git
cd redis_exporter
go build .
./redis_exporter --versionIf the build fails with an import error, set the Go proxy before rebuilding:
export GOPROXY=https://goproxy.io
go build .Start redis_exporter
For a single Redis instance:
nohup ./redis_exporter -redis.addr 127.0.0.1:6379 &
For multiple instances, start the exporter once and let Prometheus scrape each target:
nohup ./redis_exporter &
Prometheus configuration
Add the following job to prometheus.yml to scrape the exporter and the Redis instances:
- job_name: 'redis_exporter_targets'
static_configs:
- targets:
- redis://10.9.106.217:6379
- redis://10.9.106.217:6381
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.9.11.22:9121
- job_name: 'redis_exporter'
static_configs:
- targets:
- 10.9.11.22:9121Reload the configuration:
sudo curl 'http://localhost:9090/-/reload' -X POST
Collected Redis metrics are now visible in Prometheus.
Configure Grafana
Add a Prometheus data source in Grafana and install the Prometheus plugin.
Download the Redis dashboard JSON (e.g., from Grafana.com ) and import it, selecting the Prometheus data source.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
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.
