启动kafka时报连接错误Opening socket connection to server **:2181 Will not attempt to authenticate using SASL

启动kafka时的错误:

[2021-02-03 12:02:48,119] INFO Initiating client connection, 
connectString=bigdata112:2181,bigdata113:2181,bigdata114:2181 sessionTimeout=6000 
watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@1d296da 
(org.apache.zookeeper.ZooKeeper)
[2021-02-03 12:02:48,131] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-

initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-02-03 12:02:48,139] INFO jute.maxbuffer value is 4194304 Bytes 
(org.apache.zookeeper.ClientCnxnSocket)
[2021-02-03 12:02:48,158] INFO zookeeper.request.timeout value is 0. feature enabled= 
(org.apache.zookeeper.ClientCnxn)
[2021-02-03 12:02:48,169] INFO Opening socket connection to server bigdata112/192.168.112.112:2181. 
Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-02-03 12:02:48,193] INFO Socket connection established, initiating session, client: 
/192.168.112.112:39588, server: bigdata112/192.168.112.112:2181 (org.apache.zookeeper.ClientCnxn)
[2021-02-03 12:02:48,176] INFO [ZooKeeperClient Kafka server] Waiting until connected. 
(kafka.zookeeper.ZooKeeperClient)
[2021-02-03 12:02:48,217] INFO Session establishment complete on server 
bigdata112/192.168.112.112:2181, sessionid = 0x17765f615e80007, negotiated timeout = 6000 
(org.apache.zookeeper.ClientCnxn)
[2021-02-03 12:02:48,248] INFO [ZooKeeperClient Kafka server] Connected. 
(kafka.zookeeper.ZooKeeperClient)
[2021-02-03 12:02:48,626] INFO Cluster ID = LL5K9HwoSjeUn2ytibalvg (kafka.server.KafkaServer)
[2021-02-03 12:02:48,665] ERROR Fatal error during KafkaServer startup. Prepare to shutdown 
(kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID LL5K9HwoSjeUn2ytibalvg doesn't match stored 
clusterId Some(948fuFLBT2WLZ69nl0BOxg) 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:218)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
        at kafka.Kafka$.main(Kafka.scala:84)
        at kafka.Kafka.main(Kafka.scala)

起因和解决过程:
一开始启动可以启动,但是我在一台中配置了俩个broker,但是只有一个broker启动,最后发现是kafka中的server.propertis的zookeeper配置错误,把一个不再zookeeper集群中的节点配置进去了,然后我把正确zookeeper节点都配置到server.properties中,这个时候怎么也不能正常启动kafka了,根据报错信息可能是连接不到zookeeper集群了。然后我使用zookeeper里边的工具zkCli.sh连接集群中的每个节点,都是可以正常连接的,说明我的zookeeper集群是没有问题的。
然后我从报错信息中找到了这样的一句话:
kafka.common.InconsistentClusterIdException: The Cluster ID LL5K9HwoSjeUn2ytibalvg doesn’t match stored
clusterId Some(948fuFLBT2WLZ69nl0BOxg) in meta.properties
从这个报错信息看来,是说在元信息配置文件中当前的clusterid和以前在meta.properites中存储的不一致导致的。
从众多试错当中终于找见这个meta.properties的文件在你配置的kafka日志路径文件broker下有一个这样的文件,把这个文件删除了就可以了,然后会自动生成的。删除后重新启动就可以正常启动了。

你可能感兴趣的:(大数据hadoop,zookeeper,kafka)