云原生监控系统Prometheus——热加载更新配置

热加载更新配置

  在 Prometheus 的日常维护中,一定会对配置文件 prometheus.yml 进行再编辑操作,通常对 Prometheus 服务进行重启操作即可完成对配置文件的加载。

  当然也可以通过动态的热加载来更新 prometheus.yml 中的配置信息,一般热加载有两种方法:

  • 查看 Prometheus 的进程 id,进程发送 SIGHUP 信号:
kill -HUP pid
  • 通过HTTP API 发送 post 请求到 /-/reload:
curl -X POST http://localhost:9090/-/reload

  若使用第二种方式进行热加载操作,需要在 Prometheus 服务启动时指定 --web.enable-lifecycle,添加到以上的 Prometheus 自启动文件中使用。

posted @ 2022-05-25 17:34  左扬  阅读(621)  评论(0编辑  收藏  举报
levels of contents