Menu Close

What is the default retention period for a Kafka topic?

What is the default retention period for a Kafka topic?

7 days
Segment retention-related configuration settings

Kafka setting Description Default setting
retention.ms Topic-level retention period: The period of time the topic will retain old log segments before deleting or compacting them (depending on the cleanup.policy ). 604,800,000 ms (7 days)

What is retention Kafka?

Apache Kafka provides two types of Retention Policies. Time Based Retention: Once the configured retention time has been reached for Segment, it is marked for deletion or compaction depending on configured cleanup policy. Default retention period for Segments is 7 days.

How do you find the retention period in Kafka?

So, log.retention.ms would take the highest precedence.

  1. 3.1. Basics. First, let’s inspect the default value for retention by executing the grep command from the Apache Kafka directory: $ grep -i ‘log.retention.[hms].*\=’ config/server.properties log.retention.hours=168.
  2. 3.2. Retention Period for New Topic.

How do I delete old Kafka logs?

1. stop zookeeper & Kafka server, 2. then go to ‘kafka-logs’ folder , there you will see list of kafka topic folders, delete folder with topic name 3. go to ‘zookeeper-data’ folder , delete data inside that.

Can I delete Kafka logs?

1. stop zookeeper & Kafka server, 2. then go to ‘kafka-logs’ folder , there you will see list of kafka topic folders, delete folder with topic name 3. go to ‘zookeeper-data’ folder , delete data inside that. 4.

How long does Kafka store data?

There are three primary differences between Kafka and traditional messaging systems: As we described, Kafka stores a persistent log which can be re-read and kept indefinitely.

How do I change the retention period in Kafka?

When you change configurations of currently running topic using kafka-topics.sh , you should specify a topic-level property. A topic-level property for log retention time is retention.ms . Default: 7 days. Server Default Property: log.

What is the default retention period in Kafka?

The retention period of records in Kafka is configurable. The default retention period is 7 days. The retention period is specific to topic. SO in the cluster each topic can have their own retention period.

How long does it take to delete a Kafka segment?

Once the configured retention time has been reached for Segment, it is marked for deletion or compaction depending on configured cleanup policy. Default retention period for Segments is 7 days.

How long does a message last in Kafka?

If the log retention is set to five days, then the published message is available for consumption five days after it is published. After that time, the message will be de discarded to free up space. The performance of Kafka is not affected by the data size of messages, so retaining lots of data is not a problem.

How to retain a message in Apache Kafka?

When a producer sends a message to Apache Kafka, it appends it in a log file and retains it for a configured duration. In this tutorial, we’ll learn to configure time-based message retention properties for Kafka topics.