请教一个 prometheus 参数问题:--storage.tsdb.retention.time

2021-12-10 18:24:16 +08:00
 xiaoz

使用 docker-compose 部署 prometheus 的时候设置了--storage.tsdb.retention.time参数,模板如下:

version: '3'
services:
  prometheus:
    image: prom/prometheus:v2.3.1
    container_name: prometheus1
    user: "0"
    command: 
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/usr/share/prometheus/console_libraries'
      - '--web.console.templates=/usr/share/prometheus/consoles'
      - '--storage.tsdb.retention.time=7d'
    ports:
      - "127.0.0.1:19090:9090"

但是运行的时候报错了:

Error parsing commandline arguments: unknown long flag '--storage.tsdb.retention.time'
prometheus: error: unknown long flag '--storage.tsdb.retention.time'

于是我将镜像版本修改为v2.3.0v2.3.2均存在此问题,再将镜像版本修改为latest或者老版本v2.25.2则运行正常,不知道是 BUG 还是上面的版本有所变更。

从官方文档上看到推荐使用--storage.tsdb.retention.time而不是--storage.tsdb.retention,我在上面的问题版本中使用老旧的参数--storage.tsdb.retention反而可以成功,网上没找到答案,特来请教。

761 次点击
所在节点    问与答
2 条回复
mafeifan
2021-12-11 04:01:10 +08:00
使用-h 看下参数列表
xiaoz
2021-12-29 10:38:09 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/821401

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX