Retention policies
A retention policy is the part of the InfluxDB data structure that describes for how long InfluxDB keeps data.
Changing the default retention policy on an InfluxDB 1.8.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 with the database of your interest)
- type SHOW RETENTION POLICIES to list the retention policies configured for the database
- type ALTER RETENTION POLICY <policy> ON _internal_factry DURATION 12w REPLICATION 1 DEFAULT to change the duration of the retention policy, using the policy name from the previous step. Replace 12w with the duration of interest. For the internal database the policy to change is _internal_factry_rp, not autogen: Factry Historian creates that policy as the default when it provisions _internal_factry, so autogen holds no data there. Regular databases holding measurement data get no policy of their own, so for those autogen is the one to change. 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