influx CLI修改数据保存策略时间

第一步:下载influx CLI

Download the influx CLI package.
https://docs.influxdata.com/influxdb/v2/tools/influx-cli/?t=Windows

第二步:设置influx CLI

F:\tools\influxdb2-client-2.7.5-windows-amd64> influx config create --config-name config --host-url http://localhost:8086 --org myorg --token 34j18h5hZFVE27FinsZ9rQVBka62EnnmEHL_6Lp0rzQ_IHgZavMthFAKgVrA05RsHXNQO0Ozlr3lF3ubDoCT4Q== --active
 

第三步:修改保留策略时间

-- 列出所有的buckets
influx bucket list

F:\tools\influxdb2-client-2.7.5-windows-amd64>influx bucket list
ID                      Name            Retention       Shard group duration    Organization ID         Schema Type
069af8ca95cb6687        smaple          infinite        168h0m0s                a17eb7759879d6e0        implicit

-- 修改保留策略为最近两年(730d)
influx bucket update --id <bucket-id> --retention 730d

如果你是在生产环境中操作,请务必小心,因为更改保留策略可能导致数据丢失。