启动zookeeper报错:
[2021-05-10 11:12:35,798] INFO zookeeper.snapshotSizeFactor = 0.33 (org.apache.zookeeper.server.ZKDatabase)
[2021-05-10 11:12:35,815] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: No snapshot found, but there are log entries. Something is broken!
……
zookeeper配置文件定义的dataDir路径是/tmp,我看根目录磁盘空间100%了,推测磁盘空间不足导致的zookeeper启动失败。
我删除了之前的几个log文件,还是报错。
#迁移zookeeper的数据目录
这里从/tmp下迁移到/opt/kafka/zookeeper下
cd /opt/kafka
mkdir zookeeper
将zookeeper配置文件路径改为了/opt/kafka/zookeeper:
cd /opt/kafka/config
vi zookeeper.properties
dataDir=/opt/kafka/zookeeper
#启动zookeper
bin/zookeeper-server-start.sh config/zookeeper.properties &
#启动kafka也报错:
[2021-05-10 11:22:43,263] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID VLPFfY-WQkWmK7X9_C1aHQ doesn't match stored clusterId Some(0TVA9OzOTzCGMTqY50sBKA) 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:220)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:84)
at kafka.Kafka.main(Kafka.scala)
解决办法:
cd /tmp/kafka-logs #kafka的Log.dirs路径
cp meta.properties meta.properties_bak
修改 meta.properties中的cluster.id值,示例:
我这里将0TVA9OzOTzCGMTqY50sBKA改成了VLPFfY-WQkWmK7X9_C1aHQ