有时候在启动Kafka的时候会出现如下报错信息:
InconsistentClusterIdException: The Cluster ID -A0n-rHCT9e5IadkrA0tkw doesn't match stored clusterId Some(E-xpRlfuRqicvCYyRf9O9w) in meta.properties. The broker is trying to join the wrong cluster. Configured zookeeper.connect may be wrong.
个人尝试的解决方法是找到上面提到的meta.properties文件,这个文件在kafka的bin目录下的installkafka_2.13-2.5.0logs目录下(如果是Windows系统,则在bin/windows目录),这个目录是在Kafka初次成功启动后就自动生成的,后续创建主题和索引偏移量等信息都会在这个目录,目录文件如下:
![](https://img-blog.csdnimg.cn/2020081222345759.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3oxMDk0MjE5NDAy,size_16,color_FFFFFF,t_70)
将该文件中的cluster.id的值改成和报错信息中的值一样即可,不需要其他操作: