root@dlp:~# influx -username serverworld -password userpassword -database test_database -precision rfc3339
Connected to http://localhost:8086 version 1.6.7~rc0
InfluxDB shell version: 1.6.7~rc0
# Syntax
# - CREATE RETENTION POLICY <policy_name> ON <database> DURATION <duration> REPLICATION <n> [SHARD DURATION <duration>] [DEFAULT]
#
# DURATION ⇒ retention duration (minimum duration is 1h)
# - unit time
# - w : week
# - d : day
# - h : hour
#
# REPLICATION ⇒ number of data nodes in cluster
# - set [1] on single node
# - clustering is not supported on InfluxDB OSS 1.7
#
# SHARD DURATION ⇒ time range covered by a shard group (optional)
# show retention policy
# [autogen] is the default policy that has infinite retention
> show retention policies
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 true
# create a retention policy which has 1 day retention
> create retention policy "one_day" on "test_database" duration 1d replication 1
> show retention policies
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 true
one_day 24h0m0s 1h0m0s 1 false
# set the new policy default
> alter retention policy "one_day" on "test_database" default
> show retention policies
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 false
one_day 24h0m0s 1h0m0s 1 true
# change retention for a policy
> alter retention policy "one_day" on "test_database" duration 1w
> show retention policies
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 false
one_day 168h0m0s 1h0m0s 1 true
> exit
|