Changing Kafka Message Retention Period

Aging time is a period that messages in the topic are retained for. Consumers must retrieve messages before this period ends. Otherwise, the messages will be deleted and can no longer be retrieved.

The topic retention period is 72 hours by default, and can be changed later as required. Changing the aging time does not affect services.

You can change the aging time in either of the following ways:

Note

The log.retention.hours parameter takes effect only for topics that have no aging time configured. If there is aging time configured for a topic, it overrides the log.retention.hours parameter. For example, if the aging time of Topic01 is set to 60 hours and log.retention.hours is set to 72 hours, the actual aging time of Topic01 is 60 hours.

Procedure

  1. Log in to the console.

  2. Click image1 in the upper left corner to select a region.

    Note

    Select the region where your Kafka instance is located.

  3. Click Service List and choose Application > Distributed Message Service. The Kafka instance list is displayed.

  4. Click the desired Kafka instance to view the instance details.

  5. In the navigation pane, choose Topics.

  6. Modify the topic aging time using either of the following methods:

    • Select one or more topics and click Edit Topic in the upper left corner.

    • In the row containing the desired topic, click Edit.

  7. In the Edit Topic dialog box, enter the aging time and click OK.