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. 怎么在for循环中新建出不同的list

    public static void main(String[] args) { List<Integer> list = Arrays.asList(1, 1, 1, 1, 1, 3, ...

  2. 使用SQL中的update更新多个字段值

    使用SQL中的update更新多个字段值,set后面的条件要用逗号不能用and set后面的多个条件之间没有关联也不可以有关联,所以就不能用and了:where 条件后面 可以为and 如: upda ...

  3. HBase-概述

    一种分布式.可扩展.支持海量数据存储的 NoSQL 数据库. 逻辑上,HBase 的数据模型同关系型数据库很类似,数据存储在一张表中,有行有列.但从 HBase 的底层物理存储结构(K-V)来看,HB ...

  4. MIPS 指令集(共31条)

    MIPS 指令集(共31条) MIPS 指令集(共31条) 助记符 指令格式 示例 示例含义 操作及其解释 Bit # 31..26 25..21 20..16 15..11 10..6 5..0 R ...

  5. 数据库连接池配置(案例及排查指南) 原创: 有赞技术 有赞coder 4天前

    数据库连接池配置(案例及排查指南) 原创: 有赞技术 有赞coder 4天前

  6. 转:android DownloadManager: java.lang.SecurityException: Invalid value for visibility: 2

    1.问题描述 今天使用Android系统的DownloadManager进行下载操作时,爆了如下所示的错误: java.lang.RuntimeException: Unable to start s ...

  7. keras多层感知机MLP

    肯定有人要说什么多层感知机,不就是几个隐藏层连接在一起的吗.话是这么说,但是我觉得我们首先要自己承认自己高级,不然怎么去说服(hu nong)别人呢 from keras.models import ...

  8. leetcode 55. Jump Game、45. Jump Game II(贪心)

    55. Jump Game 第一种方法: 只要找到一个方式可以到达,那当前位置就是可以到达的,所以可以break class Solution { public: bool canJump(vecto ...

  9. Qt编写控件属性设计器6-动态属性

    一.前言 之前就提过,Qt的属性机制强大到爆,这次的动态属性功能就是要让他爆,很难想象只要一行代码即可widget->setProperty("value", value); ...

  10. C#反射回顾笔记

    一 .反射概述 反射提供描述程序集.模块和类型的对象(Type 类型). 可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型,然后调用其方法或访问其字段和属性. 如果代码中 ...