Skip to content
鼓励作者:欢迎打赏犒劳

监控Mysql

linux环境下载:https://prometheus.io/download/

linux版本

下载

shell
wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.14.0/mysqld_exporter-0.14.0.linux-amd64.tar.gz

解压

shell
tar -zxvf mysqld_exporter-0.14.0.linux-amd64.tar.gz -C /data
mv /data/mysqld_exporter-0.14.0.linux-amd64 /data/mysqld_exporter
cp /data/mysqld_exporter /usr/sbin

创建数据库连接账号并授权

shell
create user 'mysqlexporter'@'%' identified by '123456';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'mysqlexporter'@'%' identified by '123456';
flush privileges;

创建连接数据库的配置文件

shell
cd /etc/mysqld_exporter
vim my.cnf
[client]
host=127.0.0.1
port=3306
user=mysqlexporter
password=123456

启动服务

shell
/etc/mysqld_exporter/mysqld_exporter --config.my-cnf="/etc/mysqld_exporter/my.cnf"

Grafana模版

ID: 11323

如有转载或 CV 的请标注本站原文地址