无法运行Kafka服务器

时间:2017-05-23 07:58:37

标签: apache-kafka apache-zookeeper

我正在尝试在kafka上运行Ubuntu服务器。当我运行此命令时:

> bin/zookeeper-server-start.sh config/zookeeper.properties

我没有得到任何东西,当我尝试通过此命令运行Kafka服务器时:

> bin/kafka-server-start.sh config/server.properties

我收到此错误。

WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
[2017-05-23 13:22:45,136] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)
[2017-05-23 13:22:45,754] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2017-05-23 13:22:45,857] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2017-05-23 13:22:45,859] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
    at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
    at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
    at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
    at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
    at kafka.Kafka$.main(Kafka.scala:67)
    at kafka.Kafka.main(Kafka.scala)
[2017-05-23 13:22:45,859] INFO EventThread shut down (org.apache.zookeeper.ClientCnxn)
[2017-05-23 13:22:45,860] INFO shutting down (kafka.server.KafkaServer)
[2017-05-23 13:22:45,867] INFO shut down completed (kafka.server.KafkaServer)
[2017-05-23 13:22:45,868] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)
org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000
    at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155)
    at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129)
    at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)
    at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)
    at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:168)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)
    at kafka.Kafka$.main(Kafka.scala:67)
    at kafka.Kafka.main(Kafka.scala)
[2017-05-23 13:22:45,871] INFO shutting down (kafka.server.KafkaServer)

1 个答案:

答案 0 :(得分:1)

Kafka输出表明zookeeper没有启动。

如果zookeeper-server-start.sh没有输出,请检查zookeeper.log。如果这没有帮助,请尝试使用ps查找zookeeper java进程,例如:

ps -elf | grep zookeeper

如果它正在运行,您可以使用进程的PID来获取线程转储或附加调试器以查看它所处的位置。 希望有所帮助。