我使用kafka 3.0.0的KRaft模式,安装kafka集群,报:
kafka.common.KafkaException: No
meta.properties
found in /var/lib/kafka (have you runkafka-storage.sh
to format the directory?)
错误详情:
[2021-09-28 10:59:15,461] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 10:59:15,953] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 10:59:16,092] WARN No meta.properties file under dir /var/lib/kafka/meta.properties (kafka.server.BrokerMetadataCheckpoint)
[2021-09-28 10:59:16,094] 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)
我的server.properties配置如下:
listeners=PLAINTEXT://172.21.0.1:9092,PLAINTEXT1://172.21.0.1:9091
advertised.listeners=PLAINTEXT1://172.21.0.1:9091
listener.security.protocol.map=PLAINTEXT1:PLAINTEXT,PLAINTEXT:PLAINTEXT
请问我该如何解决?
运行之前,提前执行一下
kafka-storage.sh format --config /opt/kafka/config/server.properties --cluster-id aaaaaaaaaaaaaaaaaaaaaa
来创建kafka集群元数据信息。
谢谢,少了这一步!
你的答案