大数据集群监控配置操作指导(二)node_exporter+mysql_exporter部署

芒果2年前技术文章1726

2.node_exporter监控集群服务器(所有集群服务器)

wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz

 

tar -zxvf node_exporter-1.3.1.linux-amd64.tar.gz  -C /opt/dtstack/exporters/

 

mv node_exporter-1.3.1.linux-amd64 node_exporter-1.3.1

image.png

2.1可以直接启动,同样也可以配置成服务方便管理

直接启动命令

./node_exporter

2.2配置成服务

vim /etc/systemd/system/node_exporter.service

[Unit]

Description=node_exporter

Documentation=https://prometheus.io/

After=network.target

[Service]

Type=simple

User=root

ExecStart=/opt/software/exporters/node_exporter-1.3.1/node_exporter

Restart=on-failure

[Install]

WantedBy=multi-user.target

2.3将node_exporter的目录,和node_exporter.service文件分发到其他服务器上

2.4使node_exporter 服务生效(所有服务器)

systemctl daemon-reload

2.5启动node_exporter服务,并配置开机自启(所有服务器)

systemctl start node_exporter

 

systemctl status node_exporter

 

systemctl enable node_exporter

image.png

2.6更改prometheus的配置文件

vim /opt/dtstack/prometheus-2.33.3/prometheus.yml

 

 

 

增加

 

  - job_name: 'node_exporter'

    static_configs:

    - targets:

      - 'db001:9100'

      - 'db002:9100'

      - 'db003:9100'

      - 'db004:9100'

image.png

2.7重启prometheus

systemctl restart prometheus

 

2.8查看配置是否生效,要进入prometheus的web界面进入status,选择targets看到node_exporter存在,并且状态是up说明已经成功


image.png

3.mysql暴露监控指标

3.1下载监控mysql的mysql_exporter,安装在mysql服务所在服务器上,然后解压安装包

cd /opt/dtstack/exporters

 

wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz

 

tar -zxvf mysqld_exporter-0.13.0.linux-amd64.tar.gz  -C /opt/dtstack/exporters/

 

mv mysqld_exporter-0.13.0.linux-amd64 mysqld_exporter-0.13

 

cd mysqld_exporter-0.13


image.png

3.2登录mysql,创建exporter用户

CREATE USER 'exporter'@'%' IDENTIFIED BY 'exporter';

 

GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'%';

FLUSH PRIVILEGES;

3.3创建mysql配置文件、运行时可免密码连接数据库:

vim /opt/dtstack/exporters/mysqld_exporter-0.13/.my.cnf

[client]

user=exporter

password=exporter

3.4给mysql_exporter赋权

useradd mysql

chown -R mysql:mysql /opt/software/exporters/mysqld_exporter-0.13

image.png

3.5将mysql_exporter配置成服务

vim /etc/systemd/system/mysql_exporter.service

 

[Unit]

Description=mysql_exporter

Documentation=https://prometheus.io/

After=network.target

[Service]

User=mysql

Restart=on-failure

WorkingDirectory=/opt/dtstack/exporters/mysqld_exporter-0.13

ExecStart=/opt/dtstack/exporters/mysqld_exporter-0.13/mysqld_exporter \

          --config.my-cnf=/opt/dtstack/exporters/mysqld_exporter-0.13/.my.cnf

[Install]

WantedBy=multi-user.target

3.6启动服务,配置开机自启

systemctl daemon-reload

systemctl start mysql_exporter

systemctl status mysql_exporter

systemctl enable mysql_exporter


image.png


3.7查看mysql_exporter的端口

netstat -ntpl | grep mysql

image.png

3.8修改prometheus的配置文件

vim /opt/dtstack/prometheus-2.33.3/prometheus.yml

 

  - job_name: 'mysql_master'

    static_configs:

    - targets: ['db004:9104']

      labels:

        service_name: 'mysql_master'

        product_name: 'mysql'

systemctl restart prometheus

systemctl status prometheus

 

 


相关文章

hive执行count和spark执行count结果不一致

hive执行count和spark执行count结果不一致

【组件版本】hive on mr、spark【问题现象】hive 执行count语句,结果条数为0,spark执行count语句能正常显示count数【详细描述】hive 执行count语句:显示co...

Java-API对HDFS的操作(IDEA版)

Java-API对HDFS的操作(IDEA版)

前期工作首先就是安装maven在win系统下不配置hadoop环境,直接运行代码会报错,显示缺少winutils.exe 和 hadoop.dll 两个文件首先添加pom.xml文件  <dep...

chengying-6.0登入接口逆向

chengying-6.0登入接口逆向

版本更新首先是登入的加密url:http://172.16.121.70/login参数1. username:admin@dtstack.com2. password:614bb9438210c69...

Gartner权威报告解读|应用可观测性列为2023年重要战略技术趋势!

Gartner于今日发布企业机构在2023年需要探索的十大战略技术趋势。Gartner杰出研究副总裁Frances Karamouzis表示:“为了在经济动荡时期增加企业机构的盈利,首席信息官和IT高...

Mac安装Hadoop文档-保姆级操作(二)

Mac安装Hadoop文档-保姆级操作(二)

配置hadoop进入hadoop的目录:cd /opt/homebrew/Cellar/hadoop/3.3.6/libexec/etc/hadoop修改core-site.xml<config...

Ambari开启kerberos+安全方案

Ambari开启kerberos+安全方案

安装Kerberosserver节点安装kerberos相关软件yum install -y krb5-server krb5-workstation krb5-libsclient节点安装yum i...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。