prometheus监控mysql主从
文章目录
- prometheus监控mysql主从
- 先将MySQL部署完成,并配置好主从复制
- 主从复制节点授权exporter
- 数据库授权(master 节点执行)
- 配置mysqld 主从复制的指标暴露器
- 配置mysql 服务器 指标暴露器
- prometheus + grafana 部署
- 修改配置文件
- 启动prometheus.yml
- 部署grafana-server
prometheus监控mysql主从
先将MySQL部署完成,并配置好主从复制
主从复制节点授权exporter
数据库授权(master 节点执行)
create user 'exporter'@'%' identified by '123456';
create user 'exporter'@'127.0.0.1' identified by '123456';
create user 'exporter'@'localhost' identified by '123456';grant process,replication client,select on *.* to 'exporter'@'%' identified by 'admin123';
grant process,replication client,select on *.* to 'exporter'@'127.0.0.1' identified by 'admin123';
grant process,replication client,select on *.* to 'exporter'@'localhost' identified by 'admin123';flush privileges;
配置mysqld 主从复制的指标暴露器
上传mysqld_exporter-0.12.1.linux-amd64.tar.gz 到/opttar -zxvf mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /usr/localvim /usr/local/mysqld_exporter-0.12.1.linux-amd64/.my.cnf[client]
user=exporter
password=admin123
cd /usr/local/mysqld_exporter-0.12.1.linux-amd64./mysqld_exporter --config.my-cnf=/usr/local/mysqld_exporter-0.12.1.linux-amd64/.my.cnf
配置mysql 服务器 指标暴露器
上传node_exporter-1.1.2.linux-amd64.tar.gztar zxf node_exporter-1.1.2.linux-amd64.tar.gz -C /optcd /opt
mv node_exporter-1.1.2.linux-amd64 node_exporter
vim /usr/lib/systemd/system/node_exporter.service[Unit]Description=node_exporterDocumentation=https://prometheus.io/After=network.target[Service]Type=simpleUser=rootExecStart=/opt/node_exporter/node_exporterRestart=on-failure[Install]WantedBy=multi-user.target
systemctl daemon-reload
systemctl start node_exporter
systemctl enable node_exporter
netstat -natp | grep 9100##重载进程、开启服务、检查端口
prometheus + grafana 部署
上传、解压prometheus-2.27.1.linux-amd64.tar.gztar zxvf prometheus-2.27.1.linux-amd64.tar.gz -C /usr/local
修改配置文件
vim /usr/local/prometheus-2.27.1.linux-amd64/prometheus.yml- job_name: 'mysql-master-slave'scrape_interval: 5sstatic_configs:- targets: ['192.168.116.131:9104','192.168.116.132:9104','192.168.116.133:9104']- job_name: 'nodes'scrape_interval: 5sstatic_configs:- targets: ['192.168.116.131:9100','192.168.116.132:9100','192.168.116.133:9100']
启动prometheus.yml
./prometheus
登陆表达式浏览器 192.168.226.128:9090 ————》 查看targets
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-VaH1LG6P-1666937480146)(F:\typorase\jpg\1043.png)]
部署grafana-server
上传grafana-7.3.6-1.x86_64.rpmyum install grafana-7.3.6-1.x86_64.rpmsystemctl start grafana-server
systemctl enable grafana-servernetstat -natp | grep :3000浏览器访问:http://192.168.116.136:3000 ,默认账号和密码为 admin/admin
创建data sources 选择prometheus
定义prometheus 节点 http://192.168.116.131:9090
——》点击save & text
点击“+”输入 import ,选择模板7371 ,选择prometheus 数据源——》save 保存 mysqld-master-slave 监控
点击“+”输入 import ,选择模板8919 ,选择prometheus 数据源——》save 保存 mysqld nodes监控
prometheus监控mysql主从相关推荐
- Prometheus 监控Mysql服务器及Grafana可视化
Prometheus 监控Mysql服务器及Grafana可视化 mysql_exporter:用于收集MySQL性能信息. 使用版本 mysqld_exporter 0.11.0 官方地址 使用文档 ...
- 监控mysql的shell脚本_监控MySQL主从状态的shell脚本
分享一个Linux下,监控MySQL主从状态及配合企业微信机器人报警的Shell脚本 SLAVE_IP:为监控的主机IP USER:为msyql用户 PASSWORD:为mysql密码 WHEREIS ...
- 使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库
使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库 原文:使用 Docker 部署 Grafana + Prometheus 监控 MySQL 数据库 一.背 ...
- 用shell获取mysql主从状态_shell监控MySQL主从状态脚本两则
内容为自己的一点总结,如有不对欢迎狠劲儿拍砖 本文来自http://yijiu.blog.51cto.com/转载请经博主同意 监控主从复制正常与否 相比各位都应该知道,监控主从是否工作正常,涉及命令 ...
- nagios系列(七)nagios通过自定义脚本的方式监控mysql主从同步
nagios监控mysql主从同步 起因:nagios可能监控到mysql服务的运行情况,但确不能监控mysql的主从复制是否正常:有时候,同步已经停止,但管理人员却不知道. 登陆mysql从服务器, ...
- mysql运行状态监控研究内容_如何监控mysql主从的运行状态shell脚本实例介绍
如何监控mysql主从的运行状态shell脚本实例介绍. #!/bin/bash #define mysql variable mysql_user="root" mysql_pa ...
- zabbix3.0.4监控mysql主从同步
zabbix3.0.4监控mysql主从同步 1.监控mysql主从同步原理: 执行一个命令 mysql -u zabbix -pzabbix -e 'show slave status\G' 我们在 ...
- nagios监控mysql主从
为什么80%的码农都做不了架构师?>>> nagios监控mysql的主从,我这里介绍两种方法,一种是用nagios自带监控mysql 的插件实现,另一种是自己写脚本,下面是两 ...
- 监控mysql主从同步状态是否异常
监控mysql主从同步状态是否异常 参考文章: (1)监控mysql主从同步状态是否异常 (2)https://www.cnblogs.com/liuyansheng/p/8056268.html 备 ...
最新文章
- Python字符串常用方法(二)
- matlab cep,【CEP】重构和改进HelloInsightObservable
- snmp 获取mac add table_R语言学习笔记(1)数据获取与数据重塑的第一部分
- [2021-CVPR] Fine-grained Angular Contrastive Learning with Coarse Labels 论文简析
- windows多线程同步互斥--总结
- Robot Framework(十二) javascript基础
- 笔记-Handheld multi-frame super-resolution之一
- 数据结构笔记(十)-- 循环队列
- CISCO交换机上实现MAC和端口、IP和端口、IP和MAC的绑定
- A1113 | Integer Set Partition (25)
- 尚硅谷大数据hadoop教程
- 北京最最最牛逼的 IT 公司全在这了!
- HackerRank Breadth First Search: Shortest Reach
- DS18B20调试总结
- 计算机中rom和ram分别指什么,RAM和ROM分别是什么意思
- 班级logo设计分析
- [IOI2018]组合动作 题解
- Sencha 项目多语言和多主题的 build 配置
- 代沐研:渡尽劫波非农在,空头有望脱苦海
- 加油卡充值 数据接口
热门文章
- 创建数字证书以及使用数字签名对UWP应用包签名
- arcgis如何打开tif_ArcGis安装指南
- 自学golang【第一章:go语言基础知识】为什么要学习go语言?go语言与c语言的关系?go语言创始人?go语言的特性有哪些?go语言适合做什么?国内外有哪些企业或项目使用go语言?
- 关于C++,Java与Python取余的不同
- 原来OPPO手机还能这样清理垃圾,怪不得别人都手机都能再用5年
- 大数据模式让假货无处遁形
- mysql数据库学生成绩管理系统
- 前端获取接口状态码400的返回值
- 第002课 ubuntu环境搭建和ubuntu图形界面操作(免费)
- 呼和浩特民族学院计算机系宿舍,【呼和浩特民族学院宿舍】呼和浩特民族学院有专科吗...