prometheus软件下载地址

https://prometheus.io/download/

部署prometheus server监控软件

同步集群时间

我们在安装prometheus server监控软件之前,需要同步集群时间。

由于prometheus是一个时间序列数据库,因此其对系统时间的准确性要求很高,必须保证本机时间实时同步。

yum -y install ntpdate && ntpdate ntp1.aliyun.com

安装prometheus软件包

mkdir /app
tar -xf prometheus-2.53.4.linux-amd64.tar.gz 
mv prometheus-2.53.4.linux-amd64 /app/prometheus

Prometheus托管给systemd

cat >> /usr/lib/systemd/system/prometheus.service << EOF
[Service]
ExecStart=/app/prometheus/prometheus --config.file=/app/prometheus/prometheus.yml --web.listen-address=0.0.0.0:9091 --storage.tsdb.retention.time=10d --web.enable-lifecycle --storage.tsdb.path=/app/prometheus/data
[Install]
WantedBy=multi-user.target
[Unit]
Description=prometheus
After=network.target
EOF



参数解释:
--web.listen-address=0.0.0.0:9091:代表prometheus监听的地址
--storage.tsdb.retention.time=10d:代表数据保留时间 默认15天
--web.enable-lifecycle:代表开启热更新配置
--storage.tsdb.path=/app/prometheus/data:本地tsdb存储位置
重载/开机自启/查看状态/启动
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
systemctl status prometheus

这时我们可以在游览器中访问9090端口

image-20250423165116840

安装完成

results matching ""

    No results matching ""