Changing Kafka Message Retention Period
Aging time is a period that messages in a topic are retained for. Consumers must consume messages before this period ends. Otherwise, the messages will be deleted and can no longer be consumed.
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:
- By changing the Aging Time configuration on the Instance > Topics page.
- By changing the value of the log.retention.hours parameter on the Instance > Parameters tab page. For details, see Modifying Kafka Instance Configuration Parameters.
The log.retention.hours parameter takes effect only when the aging time has not been set for the topic. 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.
Notes and Constraints
- The retention period of a maximum of 50 topics can be modified at a time.
Modifying the Message Retention Period of a Topic
- Log in to the console.
- Click
in the upper left corner to select the region where your instance is located.
- Click
in the upper left corner and choose Application > Distributed Message Service for Kafka to open the Kafka instance list.
- Click the desired instance to go to the instance details page.
- In the navigation pane, choose Instance > Topics.
- 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.
- In the Edit Topic dialog box, enter the aging time (1–720) and click OK.
View the aging time on the Topics page.
Modifying the Message Retention Period of Multiple Topics
- Log in to the console.
- Click
in the upper left corner to select the region where your instance is located.
- Click
in the upper left corner and choose Application > Distributed Message Service for Kafka to open the Kafka instance list.
- Click the desired instance to go to the instance details page.
- In the navigation pane, choose Instance > Topics.
- Select the desired topics and click Batch Edit Topic above the list.
- In the Batch Operations area, select Aging Time (h) and enter a value (range: 1 to 720). In the Preview Change area, check the aging time before and after the modification and click OK.
Figure 1 Batch modifying the aging time
Check the new aging time on the Topics page.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot