Retention policies
A retention policy is the part of InfluxDB data structure that describes for how long InfluxDB keeps data.
Changing the default retention policy on an InfluxDB 1.x.x database
- open a terminal and run influxDB
- type auth followed by the admin credentials to authenticate
- type use _internal_factry to select the database (replace _internal_factry by the database of your interest)
- type SHOW RETENTION POLICIES to list the retention policies configured for the database
- type ALTER RETENTION POLICY autogen ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT to change the duration of the retention policy. Replace 12w with the duration of interest. More info on the duration format here .
- type SHOW RETENTION POLICIES to verify your changes
Example
bash-5.1# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> auth
username: factry
password:
> use _internal_factry
Using database _internal_factry
> SHOW RETENTION POLICIES
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 true
> ALTER RETENTION POLICY autogen ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT
> SHOW RETENTION POLICIES
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 2016h0m0s 168h0m0s 1 true