Redis Database Monitoring with Redis Exporter
Redis Database Monitoring with Redis Exporter
This guide explains how you can monitor the performance of your Redis database with the Redis Exporter service. You will monitor database health by collecting Redis metrics with Prometheus and visualizing with Grafana.
What Will You Learn in This Guide?
- Redis Exporter installation and configuration.
- Manual and automatic (script-based) installation methods.
- Visualization of data with Prometheus and Grafana integration.
1. Method: Manual Configuration
The manual configuration method is ideal for users who want to control every step.
1.1. Creating a System User
First, you must create a limited authority system user to manage Redis Exporter.
sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus
- These commands create an isolated user and group for Redis Exporter.
1.2. Redis Exporter Installation
- We will download Redis Exporter from GitHub and move it to /usr/local/bin/ directory.
curl -s https://api.github.com/repos/oliver006/redis_exporter/releases/latest | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -
tar xvf redis_exporter-*.linux-amd64.tar.gz
sudo mv redis_exporter-*.linux-amd64/redis_exporter /usr/local/bin/
- This command downloads Redis Exporter and moves it to the required directory.
1.3. Configuring the Service File
- We will create a systemd service for Redis Exporter to run in the background:
sudo vim /etc/systemd/system/redis_exporter.service
Add the following content to the file:
[Unit]
Description=Prometheus Redis Exporter
Documentation=https://github.com/oliver006/redis_exporter
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/redis_exporter \
--log-format=txt \
--namespace=redis \
--web.listen-address=:9121 \
--web.telemetry-path=/metrics
SyslogIdentifier=redis_exporter
Restart=always
[Install]
WantedBy=multi-user.target
- This service file contains all the necessary settings to start Redis Exporter.
1.4. Starting the Service
- Use these commands to start the service and enable autostart:
sudo systemctl daemon-reload
sudo systemctl enable redis_exporter
sudo systemctl start redis_exporter
- These commands start Redis Exporter and set it to run automatically at every system startup.
2. Method: Quick Installation via Script
- If you want to install using scripts, you can follow the steps below.
2.1. Target Server Configuration
Download and run the configuration script for target servers:
wget https://solutions-files.ams3.digitaloceanspaces.com/Redis-Monitoring/DO_Redis_Target_Config.sh
chmod +x DO_Redis_Target_Config.sh
./DO_Redis_Target_Config.sh
- This command performs all installation steps automatically.
2.2. Prometheus Server Configuration
Use the configuration script to add target IP addresses on the Prometheus server:
wget https://solutions-files.ams3.digitaloceanspaces.com/Redis-Monitoring/DO_Redis_Prometheus_Config.sh
chmod +x DO_Redis_Prometheus_Config.sh
./DO_Redis_Prometheus_Config.sh
- This command adds Redis Exporter targets to the Prometheus configuration.
3. Visualization with Grafana
- To visualize Redis data on Grafana, add Prometheus as a data source and then load the template file.
3.1. Introduction to Grafana
- To log in to Grafana, open the following URL in your browser:
Grafana-IP:3000
3.2. Prometheus Veri Kaynağını Ekleme
In Grafana, go to Configuration > Data Sources and add Prometheus.
3.3. Installing Dashboard
To add the dashboard, load the following JSON template from the Create > Import tab:
Frequently Asked Questions (FAQ)
1. What port does Redis Exporter use by default? Redis Exporter uses port 9121 by default. Make sure this port is open on your firewall.
2. Can I monitor multiple Redis instances with a single exporter? Yes, you can configure Redis Exporter to work with multiple Redis instances with the -redis.addr parameter.
3. What should I do if data is not visible in Grafana? Use the sudo systemctl status redis_exporter command to verify that the service is running. Then, check the targets page on Prometheus.
4. How do I update Redis Exporter? You can update the current Redis Exporter by downloading the new version and replacing it with the old version.
5. How do I check the data source settings in the Grafana panel? You can go to the Data Sources section in Grafana and check the Prometheus data source.
Result
Monitor Redis metrics with Prometheus and Grafana with Redis Exporter installation and configuration. A step-by-step guide to performance tracking. You can try it now on the GenixNode platform to monitor your Redis database with high performance and establish a secure infrastructure.

