我知道Kafka设置了默认的日志目录 /tmp/kafka-logs
存储日志和主题的内容。
但是当机器重新启动时,系统会清除/tmp中的数据,所以当我这样做时,所有的主题都会消失。
我尝试创建一个新目录来存储Kafka日志,如下所示 /home/Kafka_Data
,chmod到777。
然后修改 ~/confluent-5.5.1/etc/kafka/server.properties
:
# log.dirs=/tmp/kafka-logs
log.dirs=/home/Kafka_Data/kafka-logs
这个主题不会再消失了,但是在运行了zookeeper之后,我无法启动kafka的服务。
所以我想问有没有更好的地方来存放Kafka原木?或者这个问题不是路径,是不是和zookeeper的配置有关?
无法启动kafka服务器的错误如下:
[2020-09-15 08:47:55,101] INFO [ZooKeeperClient Kafka server] Connected. (kafka.zookeeper.ZooKeeperClient)
[2020-09-15 08:47:55,485] INFO Cluster ID = ZHT8XSrXSv-Ms6jPY8tB7w (kafka.server.KafkaServer)
[2020-09-15 08:47:55,532] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID ZHT8XSrXSv-Ms6jPY8tB7w doesn't match stored clusterId Some(bn11uRheTxeTyXnuhnxuog) in meta.properties. The broker is trying to join the wrong cluster. Configured zookeeper.connect may be wrong.
at kafka.server.KafkaServer.startup(KafkaServer.scala:341)
at io.confluent.support.metrics.SupportedServerStartable.startup(SupportedServerStartable.java:140)
at io.confluent.support.metrics.SupportedKafka.main(SupportedKafka.java:66)
[2020-09-15 08:47:55,543] INFO shutting down (kafka.server.KafkaServer)
[2020-09-15 08:47:55,572] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2020-09-15 08:47:55,678] INFO EventThread shut down for session: 0x100000307690003 (org.apache.zookeeper.ClientCnxn)
[2020-09-15 08:47:55,679] INFO Session: 0x100000307690003 closed (org.apache.zookeeper.ZooKeeper)
[2020-09-15 08:47:55,681] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2020-09-15 08:47:55,690] INFO shut down completed (kafka.server.KafkaServer)
[2020-09-15 08:47:55,706] INFO Shutting down SupportedServerStartable (io.confluent.support.metrics.SupportedServerStartable)
[2020-09-15 08:47:55,707] INFO Closing BaseMetricsReporter (io.confluent.support.metrics.BaseMetricsReporter)
[2020-09-15 08:47:55,707] INFO Waiting for metrics thread to exit (io.confluent.support.metrics.SupportedServerStartable)
[2020-09-15 08:47:55,707] INFO Shutting down KafkaServer (io.confluent.support.metrics.SupportedServerStartable)
[2020-09-15 08:47:55,708] INFO shutting down (kafka.server.KafkaServer)
[2020-09-15 08:48:25,390] INFO Expiring session 0x100000307690001, timeout of 30000ms exceeded (org.apache.zookeeper.server.ZooKeeperServer)
暂无答案!
目前还没有任何答案,快来回答吧!