[2019-05-31 06:36:19,419] INFO Socket error occurred: 10.10.14.220/10.10.14.220:2181: Connection refused (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:20,609] INFO Opening socket connection to server 10.10.14.220/10.10.14.220:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:20,610] INFO Socket error occurred: 10.10.14.220/10.10.14.220:2181: Connection refused (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:21,736] INFO Opening socket connection to server 10.10.14.220/10.10.14.220:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:21,737] INFO Socket error occurred: 10.10.14.220/10.10.14.220:2181: Connection refused (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:22,862] INFO Opening socket connection to server 10.10.14.220/10.10.14.220:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:22,862] INFO Socket error occurred: 10.10.14.220/10.10.14.220:2181: Connection refused (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:22,905] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2019-05-31 06:36:23,009] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2019-05-31 06:36:23,011] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2019-05-31 06:36:23,053] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2019-05-31 06:36:23,130] 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$waitUntilConnected$3(ZooKeeperClient.scala:242)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
        at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:238)
        at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:96)
        at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1825)
        at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:361)
        at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:385)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:205)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
        at kafka.Kafka$.main(Kafka.scala:75)
        at kafka.Kafka.main(Kafka.scala)
[2019-05-31 06:36:23,194] INFO shutting down (kafka.server.KafkaServer)
[2019-05-31 06:36:23,443] INFO shut down completed (kafka.server.KafkaServer)
[2019-05-31 06:36:23,444] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2019-05-31 06:36:23,482] INFO shutting down (kafka.server.KafkaServer)

问题描述:

    使用docker安装zookeeper和kafka是,运行kafka docker报错如上

问题原因分析:

1.开始以为是linux防火墙没开放端口原因,开了端口之后,还是报同一个错误

2.后来发现是启动zookeeper命令错误

docker run -d --name zookeeper -p 2181:2181 -t wurstmeister/zookeeper

很多网上是这么写的启动zookeeper,虽然启动了,但是其他程序无法访问

解决方式:修改zookeeper启动命令
    docker run -itd --name zookeeper -p 2181:2181 wurstmeister/zookeeper

tips:

1).-it 是允许与容器实例进行交互的,如果不加的话容器里的连接会拒绝

2). -p 端口映射,把容器的端口和宿主机的端口进行映射

Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐