kafka 在重启时丢失所有主题 [英] kafka loses all topics on reboot
问题描述
我正在 VM 中试用 Kafka (0.8.2.1),但遇到了问题:尽管在机器保持开启时一切正常(即使我重新启动 ZK/Kafka),如果我重新启动机器(优雅地关闭 ZK/Kafka 后)似乎所有 Kafka 主题都丢失了.
I'm trying out Kafka (0.8.2.1) in a VM, but am having trouble with it: though everything is fine while the machine remains on (even if I restart ZK/Kafka), if I reboot the machine (after gracefully shutting down ZK/Kafka) it seems all Kafka topics go lost.
我可能在这里遗漏了一些基本的东西,因为这可能不应该发生.可能是什么?
I'm probably missing something basic here, since this is probably not supposed to happen. What might it be?
cd /vagrant/kafka_2.11-0.8.2.1
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 10 --topic foo
bin/kafka-topics.sh --list --zookeeper localhost:2181
# foo
# ^C then resume ZooKeeper, Kafka, or both
bin/kafka-topics.sh --list --zookeeper localhost:2181
# foo
# ^C both, reboot machine, boot ZK/Kafka again
bin/kafka-topics.sh --list --zookeeper localhost:2181
# no topics
推荐答案
看起来日志的默认位置在/tmp 目录中,该目录在重新启动时会被擦除.将配置中的该位置更改为更永久的位置.
Looks like the default location for logs is in the /tmp directory which gets wiped on reboot. Change that location in the config to a more permanent location.
这篇关于kafka 在重启时丢失所有主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!