监控 Redis 运行状态:Redis Exporter

部署 Redis Exporter

这里使用二进制部署启动Redis以及Redis Exporter,具体安装细节就不做重复了

  1. mkdir /data/redis_exporter
  2. sudo wget https://github.com/oliver006/redis_exporter/releases/download/v1.3.2/redis_exporter-v1.3.2.linux-amd64.tar.gz
  3. tar -xvf redis_exporter-v1.3.2.linux-amd64.tar.gz
  4. mv redis_exporter-v1.3.2.linux-amd64 /data/redis_exporter
  5. wget https://grafana.com/api/dashboards/763/revisions/1/download
  6. ## 无密码
  7. ./redis_exporter redis//172.26.42.229:6379
  8. ## 有密码
  9. ./redis_exporter -redis.addr 172.26.42.229:6379 -redis.password 123456
  10. cat > /etc/systemd/system/redis_exporter.service <<EOF
  11. [Unit]
  12. Description=redis_exporter
  13. After=network.target
  14. [Service]
  15. Type=simple
  16. User=prometheus
  17. ExecStart=/data/redis_exporter/redis_exporter -redis.addr 172.26.42.229:6379 -redis.password 123456
  18. Restart=on-failure
  19. [Install]
  20. WantedBy=multi-user.target
  21. EOF
  22. - job_name: redis
  23. static_configs:
  24. - targets: ['1172.26.42.229:9121']
  25. labels:
  26. instance: redis120