redis_exporter 结合prometheus 监控redis cluster集群
- 前提1:已经搭建好redis cluster集群
- 前提2:已搭建好prometheus
1、下载redis_exporter
wget https://github.com/oliver006/redis_exporter/releases/download/v1.50.0/redis_exporter-v1.50.0.linux-amd64.tar.gz
2、解压并启动
tar xf redis_exporter-v1.50.0.linux-amd64.tar.gz -C /usr/local
cd /usr/local/redis_exporter-v1.50.0
nohup ./redis_exporter -redis.addr 192.168.1.21:7001,192.168.1.22:7001,192.168.1.23:7001,192.168.1.24:7001,192.168.1.25:7001,192.168.1.26:7001 -web.listen-address :9192 -redis.password YourPassw0rdx &
3、增加配置prometheus.yml
- job_name: 'redis_exporter_targets'
static_configs:
- targets:
- redis://192.168.1.21:7001
- redis://192.168.1.22:7001
- redis://192.168.1.23:7001
- redis://192.168.1.24:7001
- redis://192.168.1.25:7001
- redis://192.168.1.26:7001
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 192.168.1.21:9121
- job_name: 'redis_exporter'
static_configs:
- targets:
- 192.168.1.21:9121
4、重启或者热加载prometheus
热加载需要启动时开启参数-web.enable-lifecycle
curl -XPOST http://10.140.20.200:9090/-/reload
5、prometheus验证
6、添加grafana面板
-
https://grafana.com/grafana/dashboards/?plcmt=footer&search=redis
-
grafana面板id: 763