aa

https://blog.csdn.net/cheng1804/article/details/88203422

 

Prometheus配置的热加载

Prometheus配置信息的热加载有两种方式:

第一种热加载方式:查看Prometheus的进程id,发送 SIGHUP 信号:

kill -HUP <pid>

第二种热加载方式:发送一个POST请求到 /-/reload ,需要在启动时给定 --web.enable-lifecycle 选项:

curl -X POST http://localhost:9090/-/reload

如果配置热加载成功,Prometheus会打印出下面的log:

... msg="Loading configuration file" filename=prometheus.yml ...

我们使用的是第一种热加载方式,systemd unit文件如下:

[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus \
 --config.file==/usr/local/prometheus/prometheus.yml \
 --storage.tsdb.path=/home/prometheus/data \
 --storage.tsdb.retention=365d \
 --web.listen-address=:9090 \
 --web.external-url=https://prometheus.frognew.com
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

在仅需要重新加载配置,而不需重启进程时,只需要运行 systemctl reload prometheus 即可。

 

以上所述就是小编给大家介绍的《在运行时热加载Prometheus的配置信息》,希望对

 

https://cloud.tencent.com/developer/article/1515327

 

https://github.com/yangchuansheng/k8s-knowledge

 

https://www.jianshu.com/p/c2e549480c50

 

https://www.cnblogs.com/JetpropelledSnake/p/10444361.html

posted on 2019-10-11 22:01  <Hbw>  阅读(338)  评论(0编辑  收藏  举报