How to see the retention for a particular topic in

2019-03-11 17:29发布

I want to see the retention period set for a particular topic. Is there any command? I tried with bin/kafka-topics.sh --zookeeper hostname:2181 --alter --config retention.ms=172800000 --topic <topic_name> for deleting 2 days old data.

But I want to see how many days are set in retention period for all the topics.

2条回答
放我归山
2楼-- · 2019-03-11 17:55

If you have altered a topic and want to view the topic configuration the following command will be helpful

kafka-topics.sh --zookeeper localhost:2181 --describe --topics-with-overrides

This will describe only the topics along with configurations that have configurations set that differ from the cluster defaults.

If you want to view the configurations for all topic Either you can view these properties log.retention.hours or log.retention.ms in server.properties in kafka config directory.

查看更多
\"骚年 ilove
3楼-- · 2019-03-11 18:07

See config 'log.retention.hours' in Kafka Doc:

The number of hours to keep a log file before deleting it (in hours), tertiary to log.retention.ms property

Default value is 168 hours which is 7 days.

查看更多
登录 后发表回答