内容简介:Promtheus的时序数据库在存储了大量的数据后,每次重启Prometheus进程的时间会越来越慢。 而在日常运维工作中会经常调整Prometheus的配置信息,实际上Prometheus提供了在运行时热加载配置信息的功能。Prometheus配置信息的热加载有两种方式:第一种热加载方式:查看Prometheus的进程id,发送
Promtheus的时序数据库在存储了大量的数据后,每次重启Prometheus进程的时间会越来越慢。 而在日常运维工作中会经常调整Prometheus的配置信息,实际上Prometheus提供了在运行时热加载配置信息的功能。
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的配置信息》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- spark源码解析-从提交任务到jar的加载运行(基于2.1.0版本)
- 使用 Javassist 在运行时重新加载类「替换原方法输出不一样的结果」| 字节码编程 · Javassist 03
- 介绍同步加载、异步加载、延迟加载[原创]
- .net加载失败的程序集重新加载
- 虚拟机类加载机制:类加载时机
- 探秘类加载器和类加载机制
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Twenty Lectures on Algorithmic Game Theory
Tim Roughgarden / Cambridge University Press / 2016-8-31 / USD 34.99
Computer science and economics have engaged in a lively interaction over the past fifteen years, resulting in the new field of algorithmic game theory. Many problems that are central to modern compute......一起来看看 《Twenty Lectures on Algorithmic Game Theory》 这本书的介绍吧!