If you find that your InfluxDB database is taking up too much space, you can reduce the data retention period. Alternatively, you may wish to increase the retention period. The default retention period is 8736 hours (364 days).
This article explains how to change the InfluxDB retention period. For more information about managing InfluxDB, please refer to the official InfluxDB documentation.
- Log in to your timeseries host as
root(this is usually your orchestrator).
- Log in to the InfluxDB shell using
influx -precision rfc3339
- Check your current retention period using this query:
SHOW RETENTION POLICIES ON "opsview"
- Change your retention period with a query like this:
ALTER RETENTION POLICY autogen ON opsview DURATION <duration> REPLICATION 1 SHARD DURATION 7d
<duration> with your desired duration. For example:
28w for 28 weeks,
256h for 256 hours.
Dropping shards after reducing retention period
After reducing the retention period, you may wish to drop some shards.
You can list all shards with this InfluxQL query:
You can drop shards with a query like this:
DROP SHARD <shard_id>