已解决
Docker 安装MySQL Exporter
来自网友在路上 169869提问 提问时间:2023-09-20 09:12:21阅读次数: 69
最佳答案 问答题库698位专家为你答疑解惑
1.拉取镜像
[root@localhost ~]# docker pull prom/mysqld-exporter
2.MySQL创建用户并分配权限
CREATE USER 'exporter'@'localhost' IDENTIFIED BY '123456' WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';
FLUSH PRIVILEGES;
注:localhost需要改为mysqld-exporter安装机器IP
3.创建文件my.cnf
[root@localhost ~]# mkdir -p /data/mysqld_exporter
[root@localhost ~]# cd /data/mysqld_exporter
[root@localhost ~]# vim my.cnf[client]
host=192.168.1.100
user=exporter
password=123456
4.创建容器
[root@localhost ~]# docker run -d -p 9104:9104 --name mysqld-exporter --restart=always --volume=/data/mysqld_exporter/my.cnf:/etc/mysql/my.cnf:ro prom/mysqld-exporter --config.my-cnf=/etc/mysql/my.cnf
参数说明:
- -d:后台运行
- -p: 端口映射
- -name:设置容器名称
- –restart:设置开机启动
- –volume:目录映射
- –config.my-cnf:指定配置文件
官方地址:https://github.com/prometheus/mysqld_exporter
查看全文
99%的人还看了
相似问题
猜你感兴趣
版权申明
本文"Docker 安装MySQL Exporter":http://eshow365.cn/6-9902-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!