欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > 数据库 >内容正文

数据库

redis启动没反应_Promethues如何针对Redis进行监控

发布时间:2025/3/11 数据库 84 豆豆
生活随笔 收集整理的这篇文章主要介绍了 redis启动没反应_Promethues如何针对Redis进行监控 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

需求:采用redis_exporter 收集数据,promethus采集redis_exporter数据,granfana展示数据

一、简易安装redis

yum install -y redisrpm -qa |grep redislsof -i :6379rpm -ql redissystemctl start redis
  • 找到配置文件/etc/redis.conf,修改 requirepass QpMD61xo
  • 重启动redis systemctl restart redis

二、下载redis_exporter 收集redis数据

wget https://github.com/oliver006/redis_exporter/releases/download/v1.4.0/redis_exporter-v1.4.0.linux-amd64.tar.gztar zxvf redis_exporter-v1.4.0.linux-amd64.tar.gzmv redis_exporter-v1.4.0.linux-amd64 /usr/local/exporter/redis_exportercd /usr/local/exporter/redis_exporter## 有密码nohup ./redis_exporter -redis.addr 127.0.0.1:6379 -redis.password QpMD61xo ## 无密码nohup ./redis_exporter -redis.addr 192.168.1.120:6379 &
  • 日志信息
[root@Prometheus redis_exporter]# tail -f nohup.out time="2020-02-22T12:26:24+08:00" level=info msg="Redis Metrics Exporter v1.4.0 build date: 2020-02-22-02:07:24 sha1: dde61ca2367f5fdb1f4a0c49022fcb0135715d22 Go: go1.13.8 GOOS: linux GOARCH: amd64"time="2020-02-22T12:26:24+08:00" level=info msg="Providing metrics at :9121/metrics"
  • 查看redis_exporte是否开启 lsof -i:9121

三、配置promethus 采集数据

  • 修改prometheus配置文件 vim /usr/local/prometheus/prometheus.yml
- job_name: 'redis' scrape_interval: 10s static_configs: - targets: ["114.67.116.119:9121"]
  • 重载配置文件
kill -hup `ps -ef |grep prometheus|grep -v grep|awk '{print $2}'`或者kill -9 PID/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml

四、granfna配置

  • 配置prometheus数据源,添加prometheus插件,导入763模板 https://grafana.com/grafana/dashboards/763/revisions

注意 redis 添加密码后,一定要重启动redis服务,否则granfna获取不到数据。(折腾了半天没数据。。)

总结

以上是生活随笔为你收集整理的redis启动没反应_Promethues如何针对Redis进行监控的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。