Why kafka doenst start for me? - apache-kafka

I'm learning kafka at the moment but unfortunately I'm stuck because my kafka can't start when I run the following command in cmd
kafka-server-start.bat .\config\server.properties
my zookeeper works very well
here is the error
[2021-09-23 17:18:03,849] INFO Opening socket connection to server localhost/<unresolved>:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-09-23 17:18:03,850] WARN Session 0x0 for server localhost/<unresolved>:2181, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
java.nio.channels.UnresolvedAddressException
at java.base/sun.nio.ch.Net.checkAddress(Net.java:149)
at java.base/sun.nio.ch.Net.checkAddress(Net.java:157)
at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(SocketChannelImpl.java:816)
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:839)
at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1021)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1064)
[2021-09-23 17:18:04,318] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2021-09-23 17:18:04,956] INFO Opening socket connection to server localhost/<unresolved>:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-09-23 17:18:05,061] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2021-09-23 17:18:05,061] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-09-23 17:18:05,069] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2021-09-23 17:18:05,082] 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:230)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:226)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:95)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1581)
at 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)
[2021-09-23 17:18:05,087] INFO shutting down (kafka.server.KafkaServer)
[2021-09-23 17:18:05,097] WARN Cannot invoke "kafka.utils.KafkaScheduler.shutdown()" because the return value of "kafka.server.KafkaServer.kafkaScheduler()" is null (kafka.utils.CoreUtils$)
java.lang.NullPointerException: Cannot invoke "kafka.utils.KafkaScheduler.shutdown()" because the return value of "kafka.server.KafkaServer.kafkaScheduler()" is null
at kafka.server.KafkaServer.$anonfun$shutdown$6(KafkaServer.scala:579)
at kafka.utils.CoreUtils$.swallow(CoreUtils.scala:86)
at kafka.server.KafkaServer.shutdown(KafkaServer.scala:579)
at kafka.server.KafkaServer.startup(KafkaServer.scala:329)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:75)
at kafka.Kafka.main(Kafka.scala)
[2021-09-23 17:18:05,111] INFO shut down completed (kafka.server.KafkaServer)
[2021-09-23 17:18:05,112] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2021-09-23 17:18:05,116] INFO shutting down (kafka.server.KafkaServer)
i use kafka 2.12-2
java 17

I had the same problem (I was using Java 17). Following the advice of #OneCricketeer I switched to java 11 and everything worked as expected.

Related

kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING with remote host

I installed a Zookeeper and one Kafka broker server in one of my cloud server instances, and they are working well. But when trying to connect to the remote Zookeeper server, the Kafka broker is not able to reach that IP address and port number. The firewall is also in inactive mode.
The summary is:
one zookeeper server - in cloud instance [146.646.64.66*]
one Kafka broker server - in cloud instance [146.646.64.66*]
two Kafka broker server - in my local PC [localhost]
I have updated the zookeeper.connect property of the local Kafka broker server's property file as follows:
zookeeper.connect=146.646.64.66*:2181
The following is the error that the CMD shows:
[2021-06-17 19:47:01,443] INFO Initiating client connection, connectString=174.138.31.159:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$#6736fa8d (org.apache.zookeeper.ZooKeeper)
[2021-06-17 19:47:01,468] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2021-06-17 19:47:01,545] INFO zookeeper.request.timeout value is 0. feature enabled= (org.apache.zookeeper.ClientCnxn)
[2021-06-17 19:47:01,553] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2021-06-17 19:47:19,557] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2021-06-17 19:47:21,663] INFO Opening socket connection to server 146.646.64.66*/146.646.64.66*:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-06-17 19:47:21,801] WARN Client session timed out, have not heard from server in 20251ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-06-17 19:47:21,929] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2021-06-17 19:47:21,929] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-06-17 19:47:21,934] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2021-06-17 19:47:21,944] 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:271)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:267)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:125)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1948)
at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:431)
at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:456)
at kafka.server.KafkaServer.startup(KafkaServer.scala:191)
at kafka.Kafka$.main(Kafka.scala:109)
at kafka.Kafka.main(Kafka.scala)
[2021-06-17 19:47:21,982] INFO shutting down (kafka.server.KafkaServer)
Please help me solve this problem.
remove all cached log files or change the directory of the log path of the server.properties file that you are going to run. the cache log files' data can be affected due to your server history.

Getting fatal error showing time out exception when trying to run kafka server

[2021-04-08 02:53:18,713] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2021-04-08 02:53:33,182] WARN Client session timed out, have not heard from server in 18000ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-04-08 02:53:33,288] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2021-04-08 02:53:33,288] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-04-08 02:53:33,290] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2021-04-08 02:53:33,295] ****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.waitUntilConnected(ZooKeeperClient.scala:262)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:119)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1881)
at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:441)
at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:466)
at kafka.server.KafkaServer.startup(KafkaServer.scala:233)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
[2021-04-08 02:53:33,300] INFO shutting down (kafka.server.KafkaServer)
[2021-04-08 02:53:33,308] INFO App info kafka.server for 0 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2021-04-08 02:53:33,309] INFO shut down completed (kafka.server.KafkaServer)
[2021-04-08 02:53:33,310] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2021-04-08 02:53:33,311] INFO shutting down (kafka.server.KafkaServer)
It seems that the zk server is not started. Kafka needs zookeeper, you need to download and start zookeeper before start kafka server.

kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING

I am trying to install kafka in ubuntu. I have downloaded the kafka tar.gz file,unzipped it. started the zookeeper server .While trying to start the kafka server, getting the timeout exception.
Can some one pls let me know the resolution.
Following are the server logs:
kafka-server-start.sh ../config/server.properties
[2020-09-17 15:53:02,990] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2020-09-17 15:53:03,310] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2020-09-17 15:53:03,347] INFO Registered signal handlers for TERM, INT, HUP (org.apache.kafka.common.utils.LoggingSignalHandler)
[2020-09-17 15:53:03,351] INFO starting (kafka.server.KafkaServer)
[2020-09-17 15:53:03,352] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer)
[2020-09-17 15:53:03,368] INFO [ZooKeeperClient Kafka server] Initializing a new session to localhost:2181. (kafka.zookeeper.ZooKeeperClient)
[2020-09-17 15:53:03,373] INFO Client environment:zookeeper.version=3.5.8-f439ca583e70862c3068a1f2a7d4d068eec33315, built on 05/04/2020 15:53 GMT (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,373] INFO Client environment:host.name=LAPTOP-D6RGQ60T.localdomain (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,373] INFO Client environment:java.version=1.8.0_261 (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,373] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,373] INFO Client environment:java.home=/opt/jdk/jre1.8.0_261 (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,373] INFO Client environment:java.class.path=/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/activation-1.1.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/aopalliance-repackaged-2.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/argparse4j-0.7.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/audience-annotations-0.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/commons-cli-1.4.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/commons-lang3-3.8.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-api-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-basic-auth-extension-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-file-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-json-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-mirror-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-mirror-client-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-runtime-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/connect-transforms-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/hk2-api-2.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/hk2-locator-2.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/hk2-utils-2.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-annotations-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-core-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-databind-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-dataformat-csv-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-datatype-jdk8-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-jaxrs-base-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-jaxrs-json-provider-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-module-jaxb-annotations-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-module-paranamer-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jackson-module-scala_2.12-2.10.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jakarta.activation-api-1.2.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jakarta.annotation-api-1.3.4.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jakarta.inject-2.5.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jakarta.ws.rs-api-2.1.5.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jakarta.xml.bind-api-2.3.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/javassist-3.22.0-CR2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/javassist-3.26.0-GA.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/javax.servlet-api-3.1.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/javax.ws.rs-api-2.1.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jaxb-api-2.3.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-client-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-common-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-container-servlet-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-container-servlet-core-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-hk2-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-media-jaxb-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jersey-server-2.28.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-client-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-continuation-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-http-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-io-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-security-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-server-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-servlet-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-servlets-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jetty-util-9.4.24.v20191120.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/jopt-simple-5.0.4.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-clients-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-log4j-appender-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-streams-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-streams-examples-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-streams-scala_2.12-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-streams-test-utils-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka-tools-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka_2.12-2.6.0-sources.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/kafka_2.12-2.6.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/log4j-1.2.17.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/lz4-java-1.7.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/maven-artifact-3.6.3.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/metrics-core-2.2.0.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-buffer-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-codec-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-common-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-handler-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-resolver-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-transport-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-transport-native-epoll-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/netty-transport-native-unix-common-4.1.50.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/osgi-resource-locator-1.0.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/paranamer-2.8.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/plexus-utils-3.2.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/reflections-0.9.12.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/rocksdbjni-5.18.4.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/scala-collection-compat_2.12-2.1.6.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/scala-java8-compat_2.12-0.9.1.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/scala-library-2.12.11.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/scala-logging_2.12-3.9.2.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/scala-reflect-2.12.11.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/slf4j-api-1.7.30.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/slf4j-log4j12-1.7.30.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/snappy-java-1.1.7.3.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/validation-api-2.0.1.Final.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/zookeeper-3.5.8.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/zookeeper-jute-3.5.8.jar:/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin/../libs/zstd-jni-1.4.4-7.jar (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.version=4.4.0-18362-Microsoft (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:user.name=sreekanth (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:user.home=/home/sreekanth (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:user.dir=/home/sreekanth/Downloads/kafka_2.12-2.6.0/bin (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.memory.free=976MB (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,374] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,376] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$#47af7f3d (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:53:03,380] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2020-09-17 15:53:03,384] INFO zookeeper.request.timeout value is 0. feature enabled= (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:03,386] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2020-09-17 15:53:03,389] 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)
[2020-09-17 15:53:03,392] INFO Socket connection established, initiating session, client: /127.0.0.1:50975, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:21,394] WARN Client session timed out, have not heard from server in 18001ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:21,394] INFO Client session timed out, have not heard from server in 18001ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:23,114] 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)
[2020-09-17 15:53:23,115] INFO Socket connection established, initiating session, client: /127.0.0.1:50976, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:41,117] WARN Client session timed out, have not heard from server in 18001ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:41,117] INFO Client session timed out, have not heard from server in 18001ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:53:42,712] 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)
[2020-09-17 15:53:42,713] INFO Socket connection established, initiating session, client: /127.0.0.1:50977, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:00,714] WARN Client session timed out, have not heard from server in 18001ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:00,715] INFO Client session timed out, have not heard from server in 18001ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:02,432] 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)
[2020-09-17 15:54:02,433] INFO Socket connection established, initiating session, client: /127.0.0.1:50980, server: localhost/127.0.0.1:2181 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:03,388] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2020-09-17 15:54:20,433] WARN Client session timed out, have not heard from server in 18000ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:20,555] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2020-09-17 15:54:20,556] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2020-09-17 15:54:20,557] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2020-09-17 15:54:20,559] 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:262)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:258)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:119)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1865)
at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:419)
at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:444)
at kafka.server.KafkaServer.startup(KafkaServer.scala:222)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
at kafka.Kafka$.main(Kafka.scala:82)
at kafka.Kafka.main(Kafka.scala)
[2020-09-17 15:54:20,561] INFO shutting down (kafka.server.KafkaServer)
[2020-09-17 15:54:20,565] INFO shut down completed (kafka.server.KafkaServer)
[2020-09-17 15:54:20,566] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2020-09-17 15:54:20,567] INFO shutting down (kafka.server.KafkaServer)
Many Zookeeper instances were running earlier. I killed all the zookeeper and Brokers , restarted them again freshly . It is working fine now.

Kafka shutdown with zookeeper timeout

I am trying to install Kafka setup with 3 Kafka Brokers in single zookeeper node but i am seeing Kafka process getting down in fraction of minutes and throwing error in Kafka logs:
2019-05-29 14:06:42,508] INFO Opening socket connection to server kafka3/192.168.1.103:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:44,511] WARN Client session timed out, have not heard from server in 2003ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:44,511] INFO Client session timed out, have not heard from server in 2003ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:45,613] INFO Opening socket connection to server kafka2/192.168.1.102:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:47,617] WARN Client session timed out, have not heard from server in 3004ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:47,617] INFO Client session timed out, have not heard from server in 3004ms for sessionid 0x0, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:47,718] INFO Opening socket connection to server kafka1/192.168.1.101:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:48,988] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2019-05-29 14:06:49,720] WARN Client session timed out, have not heard from server in 2002ms for sessionid 0x0 (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:49,825] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2019-05-29 14:06:49,827] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2019-05-29 14:06:49,830] 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.<init>(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-29 14:06:49,833] INFO shutting down (kafka.server.KafkaServer)
[2019-05-29 14:06:49,836] INFO shut down completed (kafka.server.KafkaServer)
[2019-05-29 14:06:49,837] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2019-05-29 14:06:49,841] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2019-05-29 14:06:49,843] INFO shutting down (kafka.server.KafkaServer)
Did you start Zookeeper on that port? It seems like the Kafka server can't connect to the zookeeper.
If you are using linux, you may check the net status of the port using netstat -anlp | grep 2181
[Windows instruction]
Go to
C:\Windows\System32\drivers\etc
And add this lines:
0.0.0.0 localhost
192.168.1.103 localhost
And save file

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)
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.