mysqld_exporter 中 my.cnf 的使用和配置信息
时间: 2024-06-01 19:13:01 浏览: 17
关于mysqld_exporter中my.cnf的使用和配置信息,可以参考以下步骤:
1. 在my.cnf文件中添加以下内容:
[client]
user=exporter
password=password
[mysqld_exporter]
user=exporter
password=password
2. 然后启动mysqld_exporter时,使用以下命令:
./mysqld_exporter --config.my-cnf=/etc/my.cnf
以上就是关于mysqld_exporter中my.cnf的使用和配置信息的简单介绍,希望对你有所帮助。如果还有其他问题,请随时提出。
相关问题
root@DESKTOP-0CU081I:/mysqld_exporter-0.12.1.linux-amd64# nohup ./mysqld_exporter -config.my-cnf=".my.cnf" 2>&1 1>/tmp/mysqld_exporter.log & [4] 1481 root@DESKTOP-0CU081I:/mysqld_exporter-0.12.1.linux-amd64# nohup: ignoring input and redirecting stderr to stdout [4]+ Exit 1 nohup ./mysqld_exporter -config.my-cnf=".my.cnf" 2>&1 > /tmp/mysqld_exporter.log root@DESKTOP-0CU081I:/mysqld_exporter-0.12.1.linux-amd64# tail -f /tmp/mysqld_exporter.log mysqld_exporter: error: unknown short flag '-c', try --help
根据您的命令输出及错误信息,您的问题可能是由于在选项 `-config.my-cnf` 之前多了一个 `-` 符号。请尝试使用以下命令,去掉多余的 `-` 符号:
```
nohup ./mysqld_exporter --config.my-cnf=".my.cnf" 2>&1 > /tmp/mysqld_exporter.log &
```
这个命令应该会启动mysqld_exporter,并将输出重定向到`/tmp/mysqld_exporter.log`文件中。如果您仍然遇到问题,请告诉我您的操作系统和mysqld_exporter版本,我会尽力帮助您解决问题。
在Ubuntu20.04下如何mysqld_exporter-0.10.0.linux-amd64连接mysql8.0.33
可以按照以下步骤进行mysqld_exporter与mysql8的连接:
1. 下载并解压mysqld_exporter-0.10.0.linux-amd64.tar.gz文件:
```
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.10.0.linux-amd64.tar.gz
```
2. 修改mysqld_exporter的配置文件,以便连接mysql8:
```
vi mysqld_exporter-0.10.0.linux-amd64/mysqld_exporter.cnf
```
将文件内容修改为:
```
[client]
user = username
password = password
host = localhost
port = 3306
tls_skip_verify = true
```
其中,username和password分别为mysql8的用户名和密码。
3. 启动mysqld_exporter:
```
cd mysqld_exporter-0.10.0.linux-amd64/
./mysqld_exporter --config.my-cnf=./mysqld_exporter.cnf
```
注意要在mysqld_exporter-0.10.0.linux-amd64目录下运行mysqld_exporter。
4. 测试是否成功连接mysql8:
在浏览器中访问http://localhost:9104/metrics,如果能看到类似以下内容,则说明连接成功:
```
# HELP mysql_global_status_aborted_clients MySQL aborted clients
# TYPE mysql_global_status_aborted_clients counter
mysql_global_status_aborted_clients{instance="localhost:3306",job="mysql"} 0
# HELP mysql_global_status_aborted_connects MySQL aborted connects
# TYPE mysql_global_status_aborted_connects counter
mysql_global_status_aborted_connects{instance="localhost:3306",job="mysql"} 0
...
```
如果连接失败,则需要检查mysql8的用户名、密码、主机名、端口号等是否正确。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)