Changing Metric InfluxDB Retention Policies

This document will provide the steps that are needed to change how many days of data is stored in InfluxDB. The default configuration is to store the following amount worth of data:

Note:

Steps

  1. Start a command line session to the server with the InfluxDB database.

  2. Login to the database using the Unified Assurance shortcut:

    a1influxroot
    

    Note:

    If a "command not found" error is returned, the following can be run to load the Unified Assurance shortcuts:

    source $A1BASEDIR/.bashrc
    

    Next, run "a1influxroot" again.

  3. The following can be used to get the current retention policies:

    show retention policies;
    
  4. One or more of the following queries can be used to change the retention policies. The below make the following changes:

    • Raw is changed to store 20 day's worth of data.

    • Hourly is changed to store 100 day's worth of data.

    • Daily is changed to store 800 day's worth of data.

    ALTER RETENTION POLICY "raw"    ON "Metric" DURATION 20d  REPLICATION 2 SHARD DURATION 2d DEFAULT
    ALTER RETENTION POLICY "hourly" ON "Metric" DURATION 100d REPLICATION 2 SHARD DURATION 1w
    ALTER RETENTION POLICY "daily"  ON "Metric" DURATION 800d REPLICATION 2 SHARD DURATION 30d
    

    WARNING:

    If increasing the number of days of data to keep, additional hard drive space will be utilized. This must be taken into consideration before changing the retention value.

  5. Run the "show retention policies" query again and verify that the new value(s) are reported:

    show retention policies;