Prometheus配置参数说明

  • query.max-concurrency 20

最大支持的并发查询量。

  • storage.local.checkpoint-dirty-series-limit 5000

崩溃恢复时候,只恢复5000个时序数据,这样减少了prometheus的恢复时间。如果是SSD盘,可以适当增大这个值。

  • storage.local.checkpoint-interval 5m0s

5分钟执行一次落盘,将in-memory metrics and chunks持久化到磁盘。

  • storage.local.chunk-encoding-version 1

chunks的编码格式,默认是1。

  • storage.local.engine "persisted"

开启持久化。

  • storage.local.index-cache-size.label-name-to-label-values 10485760

存放prometheus里面定义的label名称的index cache大小,默认10MB。

  • storage.local.retention 8760h0m0s

保存1年的数据。

  • storage.local.num-fingerprint-mutexes 4096

当prometheus server端在进行checkpoint操作或者处理开销较大的查询的时候,采集指标的操作会有短暂的停顿,这是因为prometheus给时间序列分配的mutexes可能不够用,可以通过这个指标来增大预分配的mutexes,有时候可以设置到上万个。

  • storage.local.target-heap-size 2147483648

prometheus独占的内存空间,默认2GB的内存空间,建议不要超过3GB。

注意:在v1.6之前,没有storage.local.target-heap-size标志。相反,必须使用标志storage.local.memory-chunks和storage.local.max-chunks-to-persist配置保存在内存中的块数。出于兼容性原因,这些标志仍然存在 但是,storage.local.max-chunks-to-persist不再有效,如果storage.local.memory-chunks设置为非零值x,则用于将storage.local.target-heap-size值覆盖为3072 * x。例如storage.local.memory-chunks=500000,则storage.local.target-heap-size值为3072 * 500000 = 1536000000Byte

  • storage.local.max-chunks-to-persist 0

废弃的参数,不再有效。

  • storage.local.memory-chunks 0

废弃的参数,设定prometheus内存中保留的chunks的最大个数。

  • storage.local.pedantic-checks false

默认false,如果设置true,崩溃恢复时候会检查每一个序列文件。

  • storage.local.series-file-shrink-ratio 0.1

用来控制序列文件rewrite的时机,默认是在10%的chunks被移除的时候进行rewrite,如果磁盘空间够大,不想频繁rewrite,可以提升该值,比如0.3,即30%的chunks被移除的时候才触发rewrite。

  • storage.local.series-sync-strategy "adaptive"

控制写入数据之后,何时同步到磁盘,有‘never‘, ‘always‘, ‘adaptive‘。同步操作可以降低因为操作系统崩溃带来数据丢失,但是会降低写入数据的性能。默认为adaptive的策略,即不会写完数据就立刻同步磁盘,会利用操作系统的page cache来批量同步。

动态更新Prometheus的配置,即热更新加载,一共有两种方式:

(1)向prometheus进程发送SIGHUP信号
(2)curl -X POST http://localdns:9090/-/reload
posted @ 2021-08-19 15:42  Varden  阅读(2164)  评论(0编辑  收藏  举报