InfluxDB: Handling InfluxDB data retention

This documentation is part of the Getting started guide. View the full guide here: How to get started with InfluxDB.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use InfluxDB cloud solution that provides a host of benefits, including:

  • Unlimited writes, queries, dashboards, tasks, and buckets.
  • Unlimited data retention time.
  • Unlimited network and disk transfers.
  • Effortless updates with just a click.
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's InfluxDB cloud hosting solution!

By default, InfluxDB stores data indefinitely. While this behavior is typical for traditional databases, it is not ideal for time series databases, which should remove outdated data to prevent uncontrolled growth.

For example, if you are storing battery voltage data, it might only be relevant for a few days rather than years. To avoid filling up your disk, it is crucial to set a retention period for each of your buckets.

To configure data retention:

  1. Open your InfluxDB web UI.
  2. Click on "Data", then "Buckets".
  3. Click on "Settings" next to the bucket you want to configure.
  4. Select "Delete data older than" and choose your desired retention period.

Don't forget that data older than the selected retention period will be permanently deleted!

Keep in mind that data in InfluxDB is organized into shards. Shards containing only outdated data are deleted automatically, but if a shard contains a mix of outdated and current data, it will not be removed. By default, without a defined retention policy, shards hold 7 days of data. This means that when you set a retention policy, nearly 7 days' worth of outdated data might still be preserved alongside your current data. You will find more information about shards in the official documentation.