Operations 7 min read

Real‑time Redis Monitoring with redis‑exporter, Prometheus and Grafana Using Docker

This guide shows how to set up a complete Redis monitoring stack by launching two Redis instances, a redis‑exporter collector, and Grafana‑Prometheus visualisation all via Docker, covering container creation, IP discovery, configuration files, datasource setup and dashboard creation.

Big Data Technology & Architecture
Big Data Technology & Architecture
Big Data Technology & Architecture
Real‑time Redis Monitoring with redis‑exporter, Prometheus and Grafana Using Docker

Redis is a critical caching layer in many backend systems, and its health needs to be observed in real time; among many monitoring tools, redis_exporter combined with Prometheus and Grafana offers flexible metrics collection and intuitive visualisation.

Preparation : start two Redis containers named redis1 and redis2 using the official Docker image.

docker run -d --name redis1 redis
docker run -d --name redis2 redis

Obtain each container's IP address so that redis_exporter can scrape them.

docker inspect redis1 | grep IPAddress   # e.g., 172.17.0.5
docker inspect redis2 | grep IPAddress   # e.g., 172.17.0.6

Grafana : launch a Grafana container and map host port 3000 to the container. docker run -d --name=grafana -p 3000:3000 grafana redis_exporter : run the exporter, listening on port 9121 and pointing to the two Redis instances.

docker run -d --name redis_exporter -p 9121:9121 oliver006/redis_exporter --redis.addr=172.17.0.5:6379,172.17.0.6:6379

Prometheus : create a prometheus.yml configuration that scrapes the exporter and Prometheus itself, then start the Prometheus container mounting the file.

docker run -d --name prome -p 9090:9090 -v /tmp/prometheus.yml:/tmp/prometheus.yml quay.io/prometheus/prometheus --config.file=/tmp/prometheus.yml

The configuration defines two scrape jobs: one for localhost:9090 (Prometheus metrics) and one for localhost:9121 (redis_exporter metrics).

At this point five containers are running: two Redis instances, redis_exporter, Prometheus, and Grafana (see the accompanying screenshots).

Grafana Dashboard : access Grafana at http://127.0.0.1:3000 (default admin/admin), add a Prometheus datasource pointing to http://127.0.0.1:9090, and create panels. For example, the metric redis_up can be queried at http://127.0.0.1:9121/metrics and visualised in Grafana.

Build a simple chart showing Redis uptime, or import an existing Redis dashboard template from https://grafana.com/api/dashboards/763/revisions/1/download to get a comprehensive set of panels (memory usage, hit rate, command count, etc.).

Finally, the completed monitoring view displays all key Redis indicators, and the stack can be extended with additional exporters to monitor other services.

For more details, refer to the original article on CSDN.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

monitoringDockerredisPrometheusGrafanaExporter
Big Data Technology & Architecture
Written by

Big Data Technology & Architecture

Wang Zhiwu, a big data expert, dedicated to sharing big data technology.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.