简体   繁体   English

Kafka何时删除主题?

[英]When does Kafka delete a topic?

I am very new to Kafka and I am dabbling about with it. 我是Kafka的新手,我对此有些疑惑。

Say I have Kafka running on a Debian machine and I have managed to create a topic with a 100 messages on it. 假设我在Debian机器上运行了Kafka,并且设法创建了一个包含100条消息的主题。

After that initial burst of activity (ie placing a 100 messages onto the topic via some Kafka Producer) the Topic is just sat there idle with nothing happening (no consumers consuming and no producers producing) 在最初的活动激增之后(即通过某个Kafka生产者向该主题发送100条消息),该主题只是闲置无事(无消费者消费,无生产者生产)

I am aware of a Message Retention Policy setting, which I believe has a default value of 7 days. 我知道“邮件保留策略”设置,我相信它的默认值为7天。 Let's say those 7 days pass, and the messages are indeed removed from the Topic, but what about the Topic itself? 假设这7天过去了,消息确实从主题中删除了,但是主题本身呢?

Will Kafka eventually kill that Topic? 卡夫卡最终会杀死那个话题吗?

Also, what happens when I manually go and pull out the power cord for the machine that Kafka is running on? 另外,当我手动去掉运行Kafka的机器的电源线时会发生什么? Will the Topic be discarded? 主题将被丢弃吗? Or will I still have my topic after I start up the machine, run ZooKeeper and create a Kafka Broker? 还是在启动机器,运行ZooKeeper并创建Kafka Broker之后仍然有我的主题?

Any light on this matter would be appreciated. 任何对此事的理解将不胜感激。

Thank you 谢谢

No, Kafka will keep the topic. 不,Kafka将保留主题。 It sounds like a bad idea that Kafka deletes topics by itself. Kafka自行删除主题听起来像个坏主意。

Before version 1.0.0 the topic deletion option ( delete.topic.enable ) was set to false by default. 在1.0.0版之前,默认情况下,主题删除选项( delete.topic.enable )设置为false。 So it wasn't even possible to delete it without changing the config. 因此,即使不更改配置也无法删除它。

So the answer for you question would be Kafka never deletes topics. 因此,问题的答案将是Kafka从不删除主题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM