近期在对Prometheus进行线上环境配置时,领导说最好不要重启,因为会中断数据。
如果不能restart只能找办法进行reload,经过查询发现有以下两种方式可以进行reload配置。
方式一: ExecReload=/bin/kill -HUP $MAINPID
root@grafana:~# cat /etc/systemd/system/prometheus.service;
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
ExecStart=/usr/local/bin/prometheus --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/etc/prometheus/data --web.listen-address=0.0.0.0:9090
WorkingDirectory=/etc/prometheus/
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
重载命令
systemctl reload prometheus
方式二: --web.enable-lifecycle
root@grafana:~# cat /etc/systemd/system/prometheus.service;
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
ExecStart=/usr/local/bin/prometheus --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/etc/prometheus/data --web.listen-address=0.0.0.0:9090
WorkingDirectory=/etc/prometheus/
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
重载命令
curl -X POST http://localhost:9090/-/reload
标签:web,etc,--,配置,prometheus,reload,Prometheus
From: https://www.cnblogs.com/liushiya/p/18074838