1。下载安装包
Wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
2。创建运行用户
[root@localhost选择]# groupadd - r普罗米修斯
[root@localhost选择]# useradd普罗米修斯- r - g - d/s/sbin/nologin - c“普罗米修斯user"普罗米修斯
3。二进制安装
[root@localhost选择]# tar xf prometheus-2.10.0.linux-amd64.tar。广州
[root@localhost选择]# mkdir/etc/prometheus
[root@localhost选择]# mkdir/var/lib/prometheus
# cp prometheus-2.10.0 root@localhost选择。linux-amd64/普罗米修斯/usr/local/bin/
root@localhost选择# cp prometheus-2.10.0.linux-amd64/普罗米修斯。yml/etc/prometheus/
[root@localhost选择]# chown - r普罗米修斯:普罗米修斯/etc/prometheus
[root@localhost选择]# chown - r普罗米修斯:普罗米修斯/var/lib/prometheus/
[root@localhost选择]# vim/usr/lib/systemd/system/prometheus.service
4。配置启动脚本
(单位)
描述=普罗米修斯后
=网络。目标
[服务]
类型=简单的
用户=普罗米修斯
ExecStart=/usr/地方/bin/普罗米修斯\
——config.file=/etc/普罗米修斯/普罗米修斯。yml \
——storage.tsdb。路径=/var/lib/普罗米修斯\
——storage.tsdb。保留=15 d \
——网络。read-timeout=5 m \
——网络。最大连接=10 \
——查询。max-concurrency=20 \
-查询。timeout=2 m \
——web.enable-lifecycle
重启=失败
(安装)
WantedBy=multi-user.target
参数解释:
——config.file=/etc/普罗米修斯/普罗米修斯。yml # # #普罗米修斯配置文件
——storage.tsdb。路径=/var/lib/普罗米修斯# # #普罗米修斯存储数据路径
——storage.tsdb。保留15 d=# # #普罗米修斯采集数据保留时间
——网络。read-timeout m=5 # # #请求链接的最大等待时间
——网络。最大连接=10 # # #最大链接数
——查询。max-concurrency=20 # # #最大支持的并发查询量
——查询。timeout=2 m # # #单个查询超时时间
——网络。enable-lifecycle # # #热加载
5。启动
[root@localhost选择]# systemctl daemon-reload
[root@localhost选择]# systemctl使普罗米修斯
[root@localhost选择]# systemctl开始普罗米修斯
[root@localhost选择]# netstat -anlptu | grep: 9090
tcp 0 0 127.0.0.1:58628 127.0.0.1:9090建立8528/普罗米修斯
tcp6 0 0::: 9090::: * 8528/普罗米修斯听
tcp6 0 0:: 1:9090: 1:58374建立8528/普罗米修斯
tcp6 0 0 127.0.0.1:9090 127.0.0.1:58628建立8528/普罗米修斯
tcp6 0 0:: 1:58374: 1:9090建立8528/普罗米修斯