小编给大家分享一下怎样查看Redis性能监控,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
redis_exporter + prometheus +grafana监控Redis服务指标
1.redis_exporter
2.prometheus
3.grafana
本文使用 redis_exporter + prometheus +grafana 实现对Redis服务进行监控,原因:成本低,人工干预少,直接下载对应的组件,只需添加配置即可互相通信,可视化指标也比较全面。
下面是在安装了redis的Linux机器上
1.redis_exporter
下载程序压缩文件
wget https://github.com/oliver006/redis_exporter/releases/download/v0.28.0/redis_exporter-v0.28.0.linux-amd64.tar.gz
解压
tar zxf redis_exporter-v0.28.0.linux-amd64.tar.gz
cd进入目录
cd redis_exporter-v1.15.0.linux-amd64
直接运行redis_exporter程序 加&代表在后台运行, /redis_exporter &命令默认访问本机的localhost:6379,需要指定其他机器的redis使用 ./redis_exporter ip:port &
./redis_exporter &
2.prometheus
第一步还是老样子下载文件,解压文件 (v2.7.1)可以修改成需要安装的版本,可以点击https://github.com/prometheus/prometheus/releases进去找对应的版本号
wget https://github.com/prometheus/prometheus/releases/download/v2.7.1/prometheus-2.7.1.linux-amd64.tar.gz
tar zxf prometheus-2.7.1.linux-amd64.tar.gz
cd进入目录会发现一个prometheus.yml的配置文件,这个配置文件对应的每一个服务的服务名,监控地址和端口。
vim prometheus.yml
打开配置文件添加redis_exporter通信的配置
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090'] #程序在本机开通的端口号 默认9090
- job_name: 'redis'
static_configs:
- targets:
- "IP:9121" #(安装redis_exporter的IP)
运行 ps:查看有没有进程占用9090端口
./prometheus &
http://ip:9090/targets 查看是否成功

3.grafana
废话不多说
wget https://dl.grafana.com/oss/release/grafana-6.0.0-beta1.linux-amd64.tar.gz
tar zxf grafana-6.0.0-beta1.linux-amd64.tar.gz
cd grafana-6.0.0-beta1
./grafana-server start
启动后: http://ip:300 默认用户:admin,密码:admin 然后在左边找到data sources

配置Url对应你的程序地址

最后一步! 下载json模板导入进来
https://grafana.com/api/dashboards/763/revisions/1/download

上传

这里可以查看你配置那些服务监控

监控页面

看完了这篇文章,相信你对“怎样查看Redis性能监控”有了一定的了解,如果想了解更多相关知识,欢迎关注天达云行业资讯频道,感谢各位的阅读!