资源规划

组件 bigdata-node1 bigdata-node2 bigdata-node3
OS centos7.6 centos7.6 centos7.6
Prometheus Prometheus N.A N.A

安装介质

版本:prometheus-2.10.0.linux-amd64.tar.gz
下载:https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz

安装Prometheus

注意:使用root用户安装。

解压缩

  1. sudo su
  2. cd /share
  3. # 下载安装介质
  4. wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
  5. tar -zxvf /share/prometheus-2.10.0.linux-amd64.tar.gz
  6. rm -rf /share/prometheus-2.10.0.linux-amd64.tar.gz
  7. rm -rf /usr/local/prometheus
  8. mv /share/prometheus-2.10.0.linux-amd64 /usr/local/prometheus

创建相关目录

  1. mkdir -p /usr/local/prometheus/data

创建用户并授权

  1. useradd prometheus
  2. chown -R prometheus:prometheus /usr/local/prometheus

启动服务配置

  1. rm -rf /usr/lib/systemd/system/prometheus.service
  2. vi /usr/lib/systemd/system/prometheus.service

配置如下:

  1. [Unit]
  2. Description=Prometheus
  3. After=network.target
  4. [Service]
  5. Type=simple
  6. User=prometheus
  7. ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data --web.enable-admin-api
  8. ExecReload=/bin/kill -HUP $MAINPID
  9. Restart=on-failure
  10. [Install]
  11. WantedBy=multi-user.target
  • 参数说明

—web.enable-admin-api:开启Prometheus API功能

启动

  1. systemctl daemon-reload
  2. systemctl enable prometheus.service
  3. systemctl start prometheus.service
  4. systemctl stop prometheus.service

验证

  1. systemctl status prometheus.service
  2. ps -ef | grep prometheus
  3. # 端口查看
  4. netstat -anpt

Web UI:http://bigdata-node1:9090

组件安装

1. 探针安装