All Products
Search
Document Center

Time Series Database:Configure data retention policies

Last Updated:Feb 19, 2024

You can configure data retention policies for a TSDB for InfluxDB®️ database to specify the period during which data can be retained in the database. This topic describes how to configure, modify, and delete a data retention policy for a TSDB for InfluxDB®️ database.

Prerequisites

A TSDB for InfluxDB®️ database is created. For more information, see Create a database.

Introduction

You can configure a custom data retention policy for a TSDB for InfluxDB®️ database to control the amount of data stored in the database. The autogen policy is automatically configured for a database after the database is created. Based on this default retention policy, data in the database is permanently stored and shards in the database are retained for seven days. You can tailor the policy to your requirements.

Create a retention policy

  1. Log on to the TSDB console.

  2. In the upper-left corner of the console, select the region in which your instance is located.

  3. On the Instances page, click Manage in the Actions column corresponding to the instance.

  4. Choose Time Series Data Management > Databases. On the Databases page, click Storage Policy Management in the Actions column corresponding to the database for which you want to create a retention policy.

  5. On the Storage Policy Management page, click Create in the upper-right corner.

    image..png

  6. In the dialog box that appears, configure the parameters described in the following table.

    Parameter

    Description

    Retention Policy Name

    Enter the name of the retention policy. The name of a retention policy must be unique.

    Storage Duration

    Specify the retention period of data in the database.

    default

    Specify whether to set this policy to the default policy. After you set a custom retention policy to the default policy, the autogen policy is no longer the default policy.

    Note

    You can create multiple retention policies but can specify only one default policy for a database.

  7. Click OK.

    Note

    You can also configure the retention period of shards by modifying an existing data retention policy.Storage Duration of Shards For more information, see Modify a retention policy.

Modify a retention policy

  1. Log on to the TSDB console.

  2. In the upper-left corner of the console, select the region in which your instance is located.

  3. On the Instances page, click Manage in the Actions column corresponding to the instance.

  4. Choose Time Series Data Management > Databases. On the Databases page, click Storage Policy Management in the Actions column corresponding to the database for which you want to modify a retention policy.

  5. On the Storage Policy Management page, modify the retention policy.

    • Modify a single retention policy: Click Modify in the Actions column corresponding to the retention policy.

    • Modify multiple retention policies at a time: Select the policies that you want to modify, and then click Modify Selected.

      Note
      • When you modify multiple retention policies at a time, you can modify only the Storage Duration parameter of the policies.

      • To store data for a long period of time, you can configure the Storage Duration of Shards parameter of the retention policy.

  6. In the dialog box that appears, configure the parameters of the retention policy.

  7. Click OK.

Specify the default retention policy

  1. Log on to the TSDB console.

  2. In the upper-left corner of the console, select the region in which your instance is located.

  3. On the Instances page, click Manage in the Actions column corresponding to the instance.

  4. Choose Time Series Data Management > Databases. On the Databases page, click Storage Policy Management in the Actions column corresponding to the database for which you want to specify the default retention policy.

  5. On the Storage Policy Management page, click Set As Default in the Actions column corresponding to the retention policy.

    After you set a retention policy to the default policy, Yes is displayed in the Whether Is default column corresponding to the policy.

Delete a retention policy

  1. Log on to the TSDB console.

  2. In the upper-left corner of the console, select the region in which your instance is located.

  3. On the Instances page, click Manage in the Actions column corresponding to the instance.

  4. Choose Time Series Data Management > Databases. On the Databases page, click Storage Policy Management in the Actions column corresponding to the database for which you want to delete a retention policy.

  5. On the Storage Policy Management page, click Delete in the Actions column corresponding to the retention policy that you want to delete.

  6. In the message that appears, click OK.