Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Kafka Topic Log Retention Permanent

I am writing log messages into a Kafka Topic and I want the retention of this topic to be permanent. I have seen in Kafka and Kafka Connect (_schemas, connect-configs, connect-status, connect-offsets, etc) that there are special topics that are not deleted by the log retention time. How do I enforce a topic to be like these other special topics? Is it the naming convention or some other properties?

Thanks

like image 329
user1077071 Avatar asked Sep 27 '16 22:09

user1077071


People also ask

How do I change the retention period in Kafka?

Method 1) If your Kafka allow plaintext connections (via port 9092) you can do it getting into a kafka pod. Method 2) You can do it getting into zookeeper pod. You can still use deprecated script kafka-topics.sh to change retention period for a topic.

Does Kafka store data permanently?

Just like relational OLTP (online transactional processing) platforms, Kafka can now act as permanent database stores for transactional data.

What is the default retention period for a Kafka topic?

log.retention.hours The most common configuration for how long Kafka will retain messages is by time. The default is specified in the configuration file using the log. retention. hours parameter, and it is set to 168 hours, the equivalent of one week.

What is log retention period in Kafka?

The default value is 168 hours (seven days). This setting controls the period of time after which Kafka will force the log to roll, even if the segment file is not full. This ensures that the retention process is able to delete or compact old data.


1 Answers

If you want to retain all topics forever, you can set both log.retention.hours and log.retention.bytes to -1.

like image 138
highlycaffeinated Avatar answered Oct 05 '22 18:10

highlycaffeinated