kafka报Configured voter set: [1, 2] is different from the voter set read from the state file: [1]. Check if the quorum configuration is up to date, or wipe out the local state file if necessary

识趣 发表于: 2021-11-19   最后更新时间: 2021-11-19 19:55:39   4,518 游览

我使用kafka 3.0.0的KRaft模式,安装kafka集群,报:

java.lang.IllegalStateException: Configured voter set: [1, 2] is different from the voter set read from the state file: [1]. Check if the quorum configuration is up to date, or wipe out the local state file if necessary

错误详情:

[2021-11-19 19:19:08,916] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalStateException: Configured voter set: [1, 2] is different from the voter set read from the state file: [1]. Check if the quorum configuration is up to date, or wipe out the local state file if necessary
        at org.apache.kafka.raft.QuorumState.initialize(QuorumState.java:132)
        at org.apache.kafka.raft.KafkaRaftClient.initialize(KafkaRaftClient.java:362)
        at kafka.raft.KafkaRaftManager.buildRaftClient(RaftManager.scala:203)
        at kafka.raft.KafkaRaftManager.<init>(RaftManager.scala:125)
        at kafka.server.KafkaRaftServer.<init>(KafkaRaftServer.scala:73)
        at kafka.Kafka$.buildServer(Kafka.scala:79)
        at kafka.Kafka$.main(Kafka.scala:87)
        at kafka.Kafka.main(Kafka.scala)

我是在config/kraft/server.properties新增加了一个vote,如下:

增加前:

controller.quorum.voters=1@10.0.19.91:9093

增加后:

controller.quorum.voters=1@10.0.19.91:9093,2@10.0.19.92:9093

然后再启动的时候就报错了,我该如何解决?

发表于 2021-11-19

新增加的投票节点{"voterId":2} 是在哪里增加啊?谢谢!

找到config/kraft/server.properties配置文件中的log.dirs目录地址,删除里面的__cluster_metadata-0目录即可。

如(默认目录):

rm -rf /tmp/kraft-combined-logs/__cluster_metadata-0

然后重新运行kafka。

也可以单独删除其中的

rm -f /tmp/kraft-combined-logs/__cluster_metadata-0/quorum-state

还可以把新增加的投票节点{"voterId":2}手动加上去,如:

{"clusterId":"","leaderId":1,"leaderEpoch":404,"votedId":-1,"appliedOffset":0,"currentVoters":[{"voterId":1},{"voterId":2}],"data_version":0}[root@m1 __cluster_m
识趣 -> 半兽人 3年前

感谢,可以启来啦。

你的答案

查看kafka相关的其他问题或提一个您自己的问题