redis_exporter + prometheus +grafana監控redis服務指標
本文使用 redis_exporter + prometheus +grafana 實現對redis服務進行監控,原因:成本低,人工干預少,直接下載對應的組件,只需添加配置即可互相通信,可視化指標也比較全面。
下面是在安裝了redis的linux機器上
1.redis_exporter
下載程序壓縮文件
1
|
wget https: //github .com /oliver006/redis_exporter/releases/download/v0 .28.0 /redis_exporter-v0 .28.0.linux-amd64. tar .gz |
解壓
1
|
tar zxf redis_exporter-v0.28.0.linux-amd64. tar .gz |
cd進入目錄
1
|
cd redis_exporter-v1.15.0.linux-amd64 |
直接運行redis_exporter程序 加&代表在后臺運行, /redis_exporter &命令默認訪問本機的localhost:6379,需要指定其他機器的redis使用 ./redis_exporter ip:port &
1
|
./redis_exporter & |
2.prometheus
第一步還是老樣子下載文件,解壓文件 (v2.7.1)可以修改成需要安裝的版本,可以點擊https://github.com/prometheus/prometheus/releases進去找對應的版本號
1
|
wget https: //github .com /prometheus/prometheus/releases/download/v2 .7.1 /prometheus-2 .7.1.linux-amd64. tar .gz |
1
|
tar zxf prometheus-2.7.1.linux-amd64. tar .gz |
cd進入目錄會發現一個prometheus.yml的配置文件,這個配置文件對應的每一個服務的服務名,監控地址和端口。
1
|
vim prometheus.yml |
打開配置文件添加redis_exporter通信的配置
1
2
3
4
5
6
7
|
- job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] #程序在本機開通的端口號 默認9090 - job_name: 'redis' static_configs: - targets: - "ip:9121" #(安裝redis_exporter的ip) |
運行 ps:查看有沒有進程占用9090端口
1
|
./prometheus & |
http://ip:9090/targets 查看是否成功
3.grafana
廢話不多說
1
|
wget https: //dl .grafana.com /oss/release/grafana-6 .0.0-beta1.linux-amd64. tar .gz |
1
|
tar zxf grafana-6.0.0-beta1.linux-amd64. tar .gz |
1
|
cd grafana-6.0.0-beta1 |
1
|
./grafana-server start |
啟動后: http://ip:300 默認用戶:admin,密碼:admin 然后在左邊找到data sources
配置url對應你的程序地址
最后一步! 下載json模板導入進來
https://grafana.com/api/dashboards/763/revisions/1/download
上傳
這里可以查看你配置那些服務監控
監控頁面
到此這篇關于redis性能監控的實現的文章就介紹到這了,更多相關redis性能監控內容請搜索服務器之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持服務器之家!
原文鏈接:https://blog.csdn.net/qq_44015579/article/details/112009805