I have a database created with default retention policy
which is infinite
.
# SHOW RETENTION POLICIES ON "my_database"
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 0s 168h0m0s 1 true
How I can modify the retention-policy of the live database so that from now it keeps data only for last 10 days?
Easiest solution is to change(update) the current retention-policy.
ALTER RETENTION POLICY "autogen" ON "my_database" DURATION 10d
Now, after a while (ranging from 30m to 1h or more), InfluxDB will reflect the new retention-policy and trim the database off the data older than the specified 10 days.
Another approach can be to create and employ a new retention policy. Check the doc for more: https://docs.influxdata.com/influxdb/v1.2/query_language/spec/#alter-retention-policy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With