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的更多相关文章

  1. [转帖]安装prometheus+grafana监控mysql redis kubernetes等

    安装prometheus+grafana监控mysql redis kubernetes等 https://www.cnblogs.com/sfnz/p/6566951.html plug 的模式进行 ...

  2. 使用Prometheus+Grafana监控MySQL实践

    一.介绍Prometheus Prometheus(普罗米修斯)是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的.随着发展,越来越多公司和组织接受采 ...

  3. Prometheus+Grafana监控MySQL、Redis数据库

    俗话说,没有监控的系统就是在裸奔,好的监控就是运维人员的第三只手,第三只眼.本文将使用prometheus及Grafana搭建一套监控系统来监控主机及数据库(MySQL.Redis). 1.  安装G ...

  4. Prometheus + Grafana 监控(mysql 和redis)

    1.监控MySQL(mysqld-exporter) https://github.com/prometheus/mysqld_exporter/releases/download/v0.11.0/m ...

  5. prometheus+grafana监控mysql最佳实践

    导航 前言 环境准备 安装Docker 安装prometheus 安装mysqld_exporter prometheus采集数据 安装grafana grafana配置数据源 感谢您的阅读,预计阅读 ...

  6. 技术分享 | Prometheus+Grafana监控MySQL浅析

    GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 简介 Prometheus 一套开源的监控&报警&时间序列数据库的组合,通常 Kubernetes 中都会 ...

  7. 安装prometheus+grafana监控mysql redis kubernetes等

    1.prometheus安装 wget https://github.com/prometheus/prometheus/releases/download/v1.5.2/prometheus-1.5 ...

  8. cAdvisor+Prometheus+Grafana监控docker

    cAdvisor+Prometheus+Grafana监控docker 一.cAdvisor(需要监控的主机都要安装) 官方地址:https://github.com/google/cadvisor ...

  9. [转帖]Prometheus+Grafana监控Kubernetes

    原博客的位置: https://blog.csdn.net/shenhonglei1234/article/details/80503353 感谢原作者 这里记录一下自己试验过程中遇到的问题: . 自 ...

随机推荐

  1. Ubuntu 16.04安装完重启后黑屏,光标一直闪

    原文:https://blog.csdn.net/weixin_38533896/article/details/81023690 版权声明:本文为博主原创文章,转载请附上博文链接! 安装教程网址:h ...

  2. php手记之04-tp5数据库操作

    //--------查询// 原生sql语句查询 // $ret = Db::query("select * from tp5_user where id>10"); // ...

  3. legend3---18、第一阶段代码完成

    legend3---18.第一阶段代码完成 一.总结 一句话总结: 看起来麻烦或者自己因为厌烦不想做的,其实硬着头皮来做,一下子就做完了 1.layer_mobile的loading层和关闭loadi ...

  4. Java 代码编写单例模式总结

    手写一个单例模式是 Java 面试中常见的问题,很多时候我们更偏向于简单的写一个饿汉或饱汉模式,深入研究的甚少,这里列举三种实现方式,并对各自的优缺进行分析. 1. 饿汉式 public class ...

  5. 2019-8-15C#MDI窗体实现多窗口效果

    C#MDI窗体实现多窗口效果  Visual C#是微软公司推出的下一代主流程序开发语言,他也是一种功能十分强大的程序设计语言,正在受到越来越多的编程人员的喜欢.在Visual C#中,提供了为实现M ...

  6. body-parser 解析post数据

    安装 $ npm install body-parser API var bodyPaeser =require('body-parser') bodyParse.raw(option) 将请求体内容 ...

  7. 目录:JAVA

    收藏: Java:类与继承

  8. Javescript——API连接 && json数据处理(待续)

    原文链接1:How to Connect to an API with JavaScript 原文链接2:How to Use the JavaScript Fetch API to Get JSON ...

  9. 定时杀死warn进程

    6 6 * * * /root/wz/mysqlRestart.sh    #MySQL restart7 6 * * * /bin/sh /home/warn/kill_.sh8 6 * * * / ...

  10. springboot下jar包方式运行Caused by: java.lang.ExceptionInInitializerError: null

    idea调试过程中不会出现此问题,异常如下 org.springframework.beans.factory.BeanCreationException: Error creating bean w ...