prometheus+grafana监控mysql
prometheus+grafana监控mysql
1、安装配置MySQL官方的 Yum Repository(有mysql只需设置监控账号即可)
[root@localhost ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm
[root@localhost ~]# yum -y install mysql-community-server
若安装失败可能和原有的mysql有冲突,卸载原有mysql:
yum remove mariadb-config-3:10.1.20-2.el7.x86_64
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl status mysqld.service

此时MySQL已经开始正常运行,不过要想进入MySQL还得先找出此时root用户的密码,通过如下命令可以在日志文件中找出密码:
[root@localhost ~]# grep "password" /var/log/mysqld.log
如下命令进入数据库:
[root@localhost ~]#mysql -uroot -p
输入初始密码,此时不能做任何事情,因为MySQL默认必须修改密码之后才能操作数据库:(这里有个问题,新密码设置的时候如果设置的过于简单会报错:)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';mysql设置监控账号(要设置远程可连接)
CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'password' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
flush privileges;
下面是我设置的远程连接步骤,请参考:
1.登录MySQL
mysql -uroot -proot
2.进入数据库
use mysql;
3.查看是否有user表
show tables;
4.更改lost字段值
update user set host='%' where host = 'localhost';
5.刷新
flush privileges;
6.查看
select host,user from user;
2、mysql_exporter安装设置
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.10.0/mysqld_exporter-0.10.0.linux-amd64.tar.gz
tar -zxvf mysqld_exporter-0.11.0.linux-amd64.tar.gz
在安装包解压目录新增配置.my.cnf文件如下:

启动
./mysqld_exporter --config.my-cnf=./.my.cnf &
注意:
需要保持9104端口局域网可以访问
3、prometheus配置(安装prometheus的机器)
prometheus配置如下:


4、grafana操作(安装grafana的机器)
Mysql主题下载地址:https://raw.githubusercontent.com/percona/grafana-dashboards/master/dashboards/MySQL_Overview.json
其他主题下载地址:https://github.com/percona/grafana-dashboards
下载好主题后进行主题导入即可。

prometheus+grafana监控mysql的更多相关文章
- [转帖]安装prometheus+grafana监控mysql redis kubernetes等
安装prometheus+grafana监控mysql redis kubernetes等 https://www.cnblogs.com/sfnz/p/6566951.html plug 的模式进行 ...
- 使用Prometheus+Grafana监控MySQL实践
一.介绍Prometheus Prometheus(普罗米修斯)是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的.随着发展,越来越多公司和组织接受采 ...
- Prometheus+Grafana监控MySQL、Redis数据库
俗话说,没有监控的系统就是在裸奔,好的监控就是运维人员的第三只手,第三只眼.本文将使用prometheus及Grafana搭建一套监控系统来监控主机及数据库(MySQL.Redis). 1. 安装G ...
- Prometheus + Grafana 监控(mysql 和redis)
1.监控MySQL(mysqld-exporter) https://github.com/prometheus/mysqld_exporter/releases/download/v0.11.0/m ...
- prometheus+grafana监控mysql最佳实践
导航 前言 环境准备 安装Docker 安装prometheus 安装mysqld_exporter prometheus采集数据 安装grafana grafana配置数据源 感谢您的阅读,预计阅读 ...
- 技术分享 | Prometheus+Grafana监控MySQL浅析
GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 简介 Prometheus 一套开源的监控&报警&时间序列数据库的组合,通常 Kubernetes 中都会 ...
- 安装prometheus+grafana监控mysql redis kubernetes等
1.prometheus安装 wget https://github.com/prometheus/prometheus/releases/download/v1.5.2/prometheus-1.5 ...
- cAdvisor+Prometheus+Grafana监控docker
cAdvisor+Prometheus+Grafana监控docker 一.cAdvisor(需要监控的主机都要安装) 官方地址:https://github.com/google/cadvisor ...
- [转帖]Prometheus+Grafana监控Kubernetes
原博客的位置: https://blog.csdn.net/shenhonglei1234/article/details/80503353 感谢原作者 这里记录一下自己试验过程中遇到的问题: . 自 ...
随机推荐
- JAVA基础知识|String、StringBuilder、StringBuffer比较
一.简介 String:不可变字符序列 StringBuffer:线程安全的可变字符序列 StringBuilder:非线程安全的可变字符序列 二.示例分析 [示例1] String A = &quo ...
- rethinkDB python入门
Start the server For a more detailed look, make sure to read the quickstart. $ rethinkdb Import the ...
- mybatis-generator-gui如何打包成exe
快速阅读: 用wix和inno setup把mybatis-generator-gui 打包成exe和安装文件. 以后使用的时候方便,不用每次打开eclipse运行. 使用inno setup 5 ...
- C#中 Dictionary<>的使用及注意事项
1,如果在主体代码中使用,直接在初始化中生成就行 2如果在其他层,比如逻辑层,要注意在事件内部定义,在外部的话,重复调用就会提示“”“已经定义了相同的KEY”,见例子 (例子是转的) Dictiona ...
- Docs-.NET-C#-指南-语言参考-预处理器指令:#if 预处理指令
ylbtech-Docs-.NET-C#-指南-语言参考-预处理器指令:#if 预处理指令 1.返回顶部 1. #if(C# 参考) 2018/06/30 如果 C# 编译器遇到 #if 指令,最终是 ...
- osg osgUtil::LineSegmentIntersector
#ifdef _WIN32 #include <Windows.h> #endif // _WIN32 #include <osgViewer/Viewer> #include ...
- 不同操作系统上DNS客户端操作区别汇总
结论:windows有DNS缓存,Linux默认无DNS缓存,只能依赖于安装其他软件. 一.不同操作系统的客户端的DNS缓存差别 1.windows 系统中dns 解析器会使用系统的dns缓存来提高d ...
- QML使用moveToThread线程【QML工程使用C++】
一.需求来源 对于使用Qt线程,有两种方式,见本人其他文章:https://www.cnblogs.com/judes/p/6884964.html 个人认为QObject::moveToThread ...
- (错误)在VMmare中安装centos后不能联网
一.问题 在VMmare中安装centos后不能联网 在Xshell无法连接centos 二.解决方法 2.1 点击Network Adapter 设置如下图所示,首先我们在虚拟机中将网络配置设置成N ...
- WCAG
WCAG What is WCAG? Web Content Accessibility Guidelines (WCAG) Overview Checklist and solve technolo ...