zoukankan      html  css  js  c++  java
  • Prometheus + Grafana(六)系统监控之MySql

    前言

    本文主要介绍如何使用Grafana和Prometheus以及mysqld_exporter对MySql性能进行监控。

    1.安装mysqld_exporter

    1.1.上传解压

    上传mysqld_exporter-0.12.1.linux-amd64.tar安装包并解压到/usr/local目录

    tar -xvf mysqld_exporter-0.12.1.linux-amd64.tar.gz
    cd mysqld_exporter-0.12.1.linux-amd64/

    1.2.创建mysql用户

    mysqld_exporter需要连接Mysql,首先为它创建用户(exporter)并赋予所需的权限

    CREATE USER exporter IDENTIFIED BY 'Aa123456.';
    GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'exporter'@'%';
    GRANT SELECT ON performance_schema.* TO 'exporter'@'%';
    FLUSH PRIVILEGES;

    1.3.配置

    在根目录下创建my.cnf配置文件。vi my.cnf,添加以下内容:

    [client]
    user=exporter
    password=Aa123456.
    port=3306

    1.4.启动

    进入根目录下,输入以下命令:

    nohup ./mysqld_exporter --config.my-cnf="my.cnf" &
    tail -1000f nohup.out

      

    2.Prometheus配置

    2.1.配置

    修改prometheus组件的prometheus.yml加入MySql节点:

      

    2.1.启动验证

    保存以后重启Prometheus,查看targets:

      

    3.Grafana配置

    3.1.下载仪表盘

    官网查询:Mysql overView  https://grafana.com/dashboards?search=MySql%20Ov

    3.2.导入仪表盘

    3.3.查看仪表盘

     注:以上仪表盘导入后再结合自身业务修改过的

  • 相关阅读:
    栈——有效括号问题
    链表——判断是否有环,如果有,找到入口节点并返回(转自leetcode,个人留存)
    链表—判断是否有环
    链表—判断是否有环
    链表成对反转
    反转链表
    __attribute__机制
    linux write()
    错题本本-20180919
    C++ 11特性
  • 原文地址:https://www.cnblogs.com/caoweixiong/p/12133281.html
Copyright © 2011-2022 走看看