Kafka linux 采坑 | 启动报错: Timed out waiting for connection while in state: CONNECTING

zookeeper 集群启动没有问题,集群状态也正常,但是启动kafka 确报了这个错误:

Timed out waiting for connection while in state: CONNECTING (连接超时)

[2019-05-07 16:05:46,899] INFO [ZooKeeperClient] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2019-05-07 16:05:52,902] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2019-05-07 16:05:56,910] INFO Opening socket connection to server 10.0.1.130/10.0.1.130:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-07 16:05:56,915] INFO Socket connection established to 10.0.1.130/10.0.1.130:2181, initiating session (org.apache.zookeeper.ClientCnxn)
[2019-05-07 16:05:56,937] INFO Session establishment complete on server 10.0.1.130/10.0.1.130:2181, sessionid = 0x200002d94f40002, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)
[2019-05-07 16:05:56,944] INFO Session: 0x200002d94f40002 closed (org.apache.zookeeper.ZooKeeper)
[2019-05-07 16:05:56,946] INFO EventThread shut down for session: 0x200002d94f40002 (org.apache.zookeeper.ClientCnxn)
[2019-05-07 16:05:56,947] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2019-05-07 16:05:56,949] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
    at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected$1.apply$mcV$sp(ZooKeeperClient.scala:268)
    at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected$1.apply(ZooKeeperClient.scala:264)
    at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected$1.apply(ZooKeeperClient.scala:264)
    at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
    at kafka.zookeeper.ZooKeeperClient.kafka$zookeeper$ZooKeeperClient$$waitUntilConnected(ZooKeeperClient.scala:264)
    at kafka.zookeeper.ZooKeeperClient.(ZooKeeperClient.scala:97)
    at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1693)
    at kafka.server.KafkaServer.kafka$server$KafkaServer$$createZkClient$1(KafkaServer.scala:348)
    at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:372)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:202)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
    at kafka.Kafka$.main(Kafka.scala:75)
    at kafka.Kafka.main(Kafka.scala)
[2019-05-07 16:05:56,952] INFO shutting down (kafka.server.KafkaServer)
[2019-05-07 16:05:56,955] INFO shut down completed (kafka.server.KafkaServer)
[2019-05-07 16:05:56,955] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2019-05-07 16:05:56,957] INFO shutting down (kafka.server.KafkaServer)

原因:

    1.zookeeper 访问不了。 查看下zookeeper (网络是否通)是否正常启动。

    2.kafka 的zookeeper (server.properties里面)访问地址不正确,检查一下。

    3.kafka 的 broker.id (server.properties里面)没有注释掉,这里集群最好注释掉,不要手动指定。

      4.修改 kafka 配置 连接超时间,这里是以毫秒为单位。

        zookeeper.connection.timeout.ms=60000

Kafka linux 采坑 | 启动报错: Timed out waiting for connection while in state: CONNECTING_第1张图片

  ok,问题解决!!!

你可能感兴趣的:(kafka,kafka,启动,报错,linux,CONNECTING)