influxDBのretention policyを設定する
経緯
influxdbのretention policyの設定コマンドをいつも忘れてしまうので、メモ
influxdbはGrafana用に使用してます。
設定
# influx Connected to http://localhost:8086 version 1.7.6 InfluxDB shell version: 1.7.6 Enter an InfluxQL query
> show databases name: databases name ---- _internal telegraf
DBを選択
> use telegraf Using database telegraf
retention policyの設定確認
> show retention policies name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 2160h0m0s 168h0m0s 1 true
durationの変更コマンド
alter retention policy <ポリシー名> ON <DB名> duration <値>
> alter retention policy autogen ON telegraf duration 2150h > > show retention policies name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 2150h0m0s 168h0m0s 1 true
shard groupを変更する場合
alter retention policy <ポリシー名> ON <DB名> shard Duration <値>
> alter retention policy autogen ON telegraf shard Duration 150h > > show retention policies name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 2160h0m0s 150h0m0s 1 true >