Kafka topic no longer exists after restart

☆樱花仙子☆ 提交于 2019-12-02 00:27:47

kafka-topics.sh actually uses zookeeper data under the hood to answer the query. The rationale being that a single broker generally can't have enough information by itself to describe topics completely.

If you lost (which I suspect you did, since you mention a new zookeeper start) zookeeper data during your restart process, kafka-topics is now totally blind and can't see former kafka data.

The best way to check what's happening is to actually do what kafka is doing when you query it ! Launch your zookeeper client (it's as simple as doing ./zkCli.sh, and type ls /brokers/topics. If it's empty, your ZK data is lost.

Morgan Kenyon

I think you've run into the problem of the /tmp directory being cleaned out whenever your computer reboots. You either need to change the directory that you're storing your Kafka logs to, or change the $TMPTIME environmental variable in /etc/default/rcS which controls how long the tmp files are kept around (time in days).

https://askubuntu.com/questions/20783/how-is-the-tmp-directory-cleaned-up

It doesn't mean if you have the broker directories on temp that you had data on it, brokers tends to create these directories if they doesn't exist.

  • Could you try to recreate the topic, restart the machine then have a look on the /tmp directory before starting Kafka ?
  • Could you try to reproduce with changing the data directory to something other than /tmp ?
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!