我使用kafka 3.0.0的KRaft模式,安装kafka集群,报:
[2021-09-30 10:00:54,480] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
Nometa.properties
found in /var/lib/kafka (have you runkafka-storage.sh
to format the directory?)
错误详情:
[2021-09-30 10:00:54,480] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
kafka.common.KafkaException: No `meta.properties` found in /var/lib/kafka (have you run `kafka-storage.sh` to format the directory?)
at kafka.server.BrokerMetadataCheckpoint$.$anonfun$getBrokerMetadataAndOfflineDirs$2(BrokerMetadataCheckpoint.scala:164)
at scala.collection.immutable.List.foreach(List.scala:333)
at kafka.server.BrokerMetadataCheckpoint$.getBrokerMetadataAndOfflineDirs(BrokerMetadataCheckpoint.scala:153)
at kafka.server.KafkaRaftServer$.initializeLogDirs(KafkaRaftServer.scala:151)
at kafka.server.KafkaRaftServer.<init>(KafkaRaftServer.scala:53)
at kafka.Kafka$.buildServer(Kafka.scala:79)
at kafka.Kafka$.main(Kafka.scala:87)
at kafka.Kafka.main(Kafka.scala)
我的启动命令是:
bin/kafka-server-start.sh config/server.properties
请问我该如何解决?
你需要通过
kafka-storage.sh format --config /tmp/kraft-test.properties --cluster-id aaaaaaaaaaaaaaaaaaaaaa
来创建kafka集群元数据信息。
成功之后,会提醒
meta.properties
创建的位置,你需要将它移动到mv /tmp/meta.properties /var/lib/kafka/meta.properties
即可。
你的答案