Tales from the crypt: influxdb and retention policies

Folks,

don’t be this guy:

CREATE RETENTION POLICY ON <name> DURATION 30d  REPLICATION 1

because what will happen is that the custom policy is not used within your database as listed below.

All your shards will still use the standard autogen policy which will expire data according the standard policy.

To enable a custom retention policy for new shards, simply execute:

USE <database TO modify>
ALTER RETENTION POLICY <name> DEFAULT

and new shards automatically pick up the configure retention policy:

And to prevent this issue from happening again, just add the keyword DEFAULT as part of the CREATE RETENTION policy:

  1. CREATE RETENTION POLICY ON <name> DURATION 30d  REPLICATION 1 DEFAULT

 

indicating it’s preferred use over autogen.