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 Influx 1.8.x database

  1. open a terminal and run influx
  2. type auth followed by the admin credentials to authenticate
  3. type use _internal_factry to select the database (replace _internal_factry by the database of your interest)
  4. type SHOW RETENTION POLICIES to list the retention policies configured for the database
  5. 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 .
  6. 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