xiaoz
1.03D
V2EX  ›  问与答

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

By xiaoz at 2021 年 12 月 10 日 · 1625 次点击

使用 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.0和v2.3.2均存在此问题,再将镜像版本修改为latest或者老版本v2.25.2则运行正常,不知道是 BUG 还是上面的版本有所变更。

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

2 条回复
mafeifan
   1
mafeifan  
   2021 年 12 月 11 日 via iPhone
使用-h 看下参数列表
xiaoz
   2
xiaoz  
OP
   2021 年 12 月 29 日
© 2026 V2EX · 36ms · 3.9.8.5