资源规划

组件 LTSR003 LTSR005 LTSR006 LTSR007 LTSR008
OS centos7.6 centos7.6 centos7.6 centos7.6 centos7.6
Prometheus Prometheus N.A N.A 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 /home/bigdata/software/
  3. # 下载安装介质
  4. wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
  5. tar -zxvf /home/bigdata/software/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 /home/bigdata/software/prometheus-2.10.0.linux-amd64 /usr/local/prometheus

创建相关目录

mkdir -p /usr/local/prometheus/data

创建用户并授权

useradd prometheus
chown -R prometheus:prometheus /usr/local/prometheus

启动服务配置

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

配置如下:

[Unit]
Description=Prometheus
After=network.target

[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

systemctl enable prometheus.service
systemctl start prometheus.service
systemctl status prometheus.service
systemctl stop prometheus.service

验证

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

Web UI:http://LTSR003:9090

组件安装

1. 探针安装