Prometheus二进制安装方法

Prometheus 架构

1.下载安装包

[root@prometheus local]#pwd
/usr/local/
[root@prometheus local]#wget 
https://github.com/prometheus/prometheus/releases/download/v2.54.1/prometheus-
2.54.1.linux-amd64.tar.gz
[root@prometheus local]#ls -l prometheus-2.54.1.linux-amd64.tar.gz 
-rw-r--r-- 1 root root 64152439 Jul  5 21:13 prometheus-2.54.1.linuxamd64.tar.gz
[root@prometheus local]#tar xvf prometheus-2.54.1.linux-amd64.tar.gz
[root@prometheus local]#ln -s prometheus-2.54.1.linux-amd64 prometheus
[root@prometheus local]#cd prometheus/
[root@prometheus ~]#ll /usr/local/prometheus/
总计 244920
drwxr-xr-x  4 1001  127      4096  2月 26 20:14 ./
drwxr-xr-x 11 root root      4096  3月 18 10:16 ../
drwxr-xr-x  2 1001  127      4096  2月 26 20:11 console_libraries/
drwxr-xr-x  2 1001  127      4096  2月 26 20:11 consoles/
-rw-r--r--  1 1001  127     11357  2月 26 20:11 LICENSE
-rw-r--r--  1 1001  127      3773  2月 26 20:11 NOTICE
-rwxr-xr-x  1 1001  127 129611890  2月 26 19:38 prometheus*
-rw-r--r--  1 1001  127       934  2月 26 20:11 prometheus.yml
-rwxr-xr-x  1 1001  127 121143706  2月 26 19:38 promtool*
#创建相关目录
[root@prometheus prometheus]#mkdir bin conf data

[root@prometheus prometheus]#mv prometheus promtool bin/ 
[root@prometheus prometheus]#mv prometheus.yml conf/
[root@prometheus prometheus]#useradd -r -s /sbin/nologin prometheus
[root@prometheus prometheus]#chown -R prometheus.prometheus 
/usr/local/prometheus/

#修改环境变量
[root@prometheus ~]#vim /etc/profile
export PROMETHEUS_HOME=/usr/local/prometheus
export PATH=${PROMETHEUS_HOME}/bin:$PATH
[root@prometheus ~]#source /etc/profile

2.创建服务

cat > /lib/systemd/system/prometheus.service <<EOF
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target

[Service]
Restart=on-failure
User=prometheus
Group=prometheus
WorkingDirectory=/usr/local/prometheus/
ExecStart=/usr/local/prometheus/bin/prometheus \
  --config.file=/usr/local/prometheus/conf/prometheus.yml \
  --web.enable-lifecycle
ExecReload=/bin/kill -HUP \$MAINPID
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF


[root@prometheus ~]#systemctl daemon-reload
[root@prometheus ~]#systemctl enable --now prometheus.service

安装完成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值