[root@HRBB03-PUB-UNDEFINED-26-ITC51 system]# cat prometheus.service
[unit]
Description=Prometheus Server
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target
[Service]
User=root
Group=root
Type=simple
Restart=on-failure
WorkingDirectory=/opt/aspire/product/prometheus/prometheus
ExecStart=/opt/aspire/product/prometheus/prometheus/prometheus --web.listen-address=:9090 --storage.tsdb.retention=30d --web.enable-lifecycle --config.file=/opt/aspire/product/prometheus/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheusData
ExecReload=/bin/kill -HUP $MAINPID
RuntimeDirectory=prometheus
RuntimeDirectoryMode=0750
LimitNOFILE=10000
TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
[root@HRBB03-PUB-UNDEFINED-26-ITC51 system]# pwd
/usr/lib/systemd/system
WorkingDirectory=/opt/aspire/product/prometheus/prometheus? ? ##安装路径
ExecStart=/opt/aspire/product/prometheus/prometheus/prometheus --web.listen-address=:9090 --storage.tsdb.retention=30d --storage.tsdb.path=/data/prometheusData --web.enable-lifecycle --config.file=/opt/aspire/product/prometheus/prometheus/prometheus.yml
--web.listen-address=:9090? ? ##启动端口
--storage.tsdb.retention=30d? ?##保存数据时间
--storage.tsdb.path=/data/prometheusData? ? ?## 指定data 保存位置
当 要切换 保存数据位置的时候,如果 prometheus.service 配置文件中添加了
--storage.tsdb.path=/data/prometheusData? ,如果没效果,还是 之前的data保存数据,那么可能需要? ?停掉? Prometheus ,然后,删除 prometheus下的? data目录,然后 重启 Prometheus。
|