Ishan mahajan
Ishan mahajan

Reputation: 346

Not able to run Kafka server

I am trying to run kafka server on Ubuntu. When I am running this command:

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

I am not getting anything and when I am trying to run Kafka server by this command:

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

I am getting this error.

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)

Upvotes: 3

Views: 3467

Answers (1)

Michal Borowiecki
Michal Borowiecki

Reputation: 4334

Kafka output suggests zookeeper is not starting.

If zookeeper-server-start.sh produces no output, please check zookeeper.log. If that doesn't help, try finding the zookeeper java process using ps, e.g.:

ps -elf | grep zookeeper

If it's running you can use the PID of the process to obtain a thread dump or attach a debugger to see where it's stuck at. Hope that helps.

Upvotes: 1

Related Questions