1
votes

I am trying to start zookeeper server with the command

C:\kafka_2.12-2.4.1>zookeeper-server-start.bat config\zookeeper.properties

But I am getting the same error every time I try to run this command. The logs are mentioned below

[2020-04-02 17:47:01,395] INFO Reading configuration from: config\zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,398] WARN config\zookeeper.properties is relative. Prepend .\ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,408] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,408] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,415] INFO autopurge.snapRetainCount set to 3 (org.apache.zookeeper.server.DatadirCleanupManager)
[2020-04-02 17:47:01,415] INFO autopurge.purgeInterval set to 0 (org.apache.zookeeper.server.DatadirCleanupManager)
[2020-04-02 17:47:01,416] INFO Purge task is not scheduled. (org.apache.zookeeper.server.DatadirCleanupManager)
[2020-04-02 17:47:01,416] WARN Either no config or no quorum defined in config, running  in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)
[2020-04-02 17:47:01,420] INFO Log4j found with jmx enabled. (org.apache.zookeeper.jmx.ManagedUtil)
[2020-04-02 17:47:01,465] INFO Reading configuration from: config\zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,466] WARN config\zookeeper.properties is relative. Prepend .\ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,467] INFO clientPortAddress is 0.0.0.0:2181 (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,467] INFO secureClientPort is not set (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2020-04-02 17:47:01,467] INFO Starting server (org.apache.zookeeper.server.ZooKeeperServerMain)
[2020-04-02 17:47:01,477] INFO zookeeper.snapshot.trust.empty : false (org.apache.zookeeper.server.persistence.FileTxnSnapLog)
[2020-04-02 17:47:01,533] INFO Server environment:zookeeper.version=3.5.7-f0fdd52973d373ffd9c86b81d99842dc2c7f660e, built on 02/10/2020 11:30 GMT (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,533] INFO Server environment:host.name=User-PC (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,533] INFO Server environment:java.version=1.8.0_241 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,534] INFO Server environment:java.vendor=Oracle Corporation (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,534] INFO Server environment:java.home=C:\Program Files\Java\jre1.8.0_241 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,534] INFO Server environment:java.class.path=C:\kafka_2.12-2.4.1\libs\activation-1.1.1.jar;C:\kafka_2.12-2.4.1\libs\aopalliance-repackaged-2.5.0.jar;C:\kafka_2.12-2.4.1\libs\argparse4j-0.7.0.jar;C:\kafka_2.12-2.4.1\libs\audience-annotations-0.5.0.jar;C:\kafka_2.12-2.4.1\libs\commons-cli-1.4.jar;C:\kafka_2.12-2.4.1\libs\commons-lang3-3.8.1.jar;C:\kafka_2.12-2.4.1\libs\connect-api-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-basic-auth-extension-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-file-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-json-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-mirror-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-mirror-client-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-runtime-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\connect-transforms-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\guava-20.0.jar;C:\kafka_2.12-2.4.1\libs\hk2-api-2.5.0.jar;C:\kafka_2.12-2.4.1\libs\hk2-locator-2.5.0.jar;C:\kafka_2.12-2.4.1\libs\hk2-utils-2.5.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-annotations-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-core-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-databind-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-dataformat-csv-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-datatype-jdk8-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-jaxrs-base-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-jaxrs-json-provider-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-module-jaxb-annotations-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-module-paranamer-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jackson-module-scala_2.12-2.10.0.jar;C:\kafka_2.12-2.4.1\libs\jakarta.activation-api-1.2.1.jar;C:\kafka_2.12-2.4.1\libs\jakarta.annotation-api-1.3.4.jar;C:\kafka_2.12-2.4.1\libs\jakarta.inject-2.5.0.jar;C:\kafka_2.12-2.4.1\libs\jakarta.ws.rs-api-2.1.5.jar;C:\kafka_2.12-2.4.1\libs\jakarta.xml.bind-api-2.3.2.jar;C:\kafka_2.12-2.4.1\libs\javassist-3.22.0-CR2.jar;C:\kafka_2.12-2.4.1\libs\javax.servlet-api-3.1.0.jar;C:\kafka_2.12-2.4.1\libs\javax.ws.rs-api-2.1.1.jar;C:\kafka_2.12-2.4.1\libs\jaxb-api-2.3.0.jar;C:\kafka_2.12-2.4.1\libs\jersey-client-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-common-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-container-servlet-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-container-servlet-core-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-hk2-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-media-jaxb-2.28.jar;C:\kafka_2.12-2.4.1\libs\jersey-server-2.28.jar;C:\kafka_2.12-2.4.1\libs\jetty-client-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-continuation-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-http-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-io-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-security-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-server-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-servlet-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-servlets-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jetty-util-9.4.20.v20190813.jar;C:\kafka_2.12-2.4.1\libs\jopt-simple-5.0.4.jar;C:\kafka_2.12-2.4.1\libs\kafka-clients-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-log4j-appender-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-streams-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-streams-examples-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-streams-scala_2.12-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-streams-test-utils-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka-tools-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-javadoc.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-javadoc.jar.asc;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-scaladoc.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-scaladoc.jar.asc;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-sources.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-sources.jar.asc;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-test-sources.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-test-sources.jar.asc;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-test.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1-test.jar.asc;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1.jar;C:\kafka_2.12-2.4.1\libs\kafka_2.12-2.4.1.jar.asc;C:\kafka_2.12-2.4.1\libs\log4j-1.2.17.jar;C:\kafka_2.12-2.4.1\libs\lz4-java-1.6.0.jar;C:\kafka_2.12-2.4.1\libs\maven-artifact-3.6.1.jar;C:\kafka_2.12-2.4.1\libs\metrics-core-2.2.0.jar;C:\kafka_2.12-2.4.1\libs\netty-buffer-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-codec-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-common-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-handler-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-resolver-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-transport-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-transport-native-epoll-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\netty-transport-native-unix-common-4.1.45.Final.jar;C:\kafka_2.12-2.4.1\libs\osgi-resource-locator-1.0.1.jar;C:\kafka_2.12-2.4.1\libs\paranamer-2.8.jar;C:\kafka_2.12-2.4.1\libs\plexus-utils-3.2.0.jar;C:\kafka_2.12-2.4.1\libs\reflections-0.9.11.jar;C:\kafka_2.12-2.4.1\libs\rocksdbjni-5.18.3.jar;C:\kafka_2.12-2.4.1\libs\scala-collection-compat_2.12-2.1.2.jar;C:\kafka_2.12-2.4.1\libs\scala-java8-compat_2.12-0.9.0.jar;C:\kafka_2.12-2.4.1\libs\scala-library-2.12.10.jar;C:\kafka_2.12-2.4.1\libs\scala-logging_2.12-3.9.2.jar;C:\kafka_2.12-2.4.1\libs\scala-reflect-2.12.10.jar;C:\kafka_2.12-2.4.1\libs\slf4j-api-1.7.28.jar;C:\kafka_2.12-2.4.1\libs\slf4j-log4j12-1.7.28.jar;C:\kafka_2.12-2.4.1\libs\snappy-java-1.1.7.3.jar;C:\kafka_2.12-2.4.1\libs\validation-api-2.0.1.Final.jar;C:\kafka_2.12-2.4.1\libs\zookeeper-3.5.7.jar;C:\kafka_2.12-2.4.1\libs\zookeeper-jute-3.5.7.jar;C:\kafka_2.12-2.4.1\libs\zstd-jni-1.4.3-1.jar (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,541] INFO Server environment:java.library.path=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\kafka_2.12-2.4.1\bin\windows;C:\Program Files\Java\jdk1.8.0_241\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\kafka_2.12-2.4.1\bin\windows;C:\Program Files\Java\jdk1.8.0_241\bin;. (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,543] INFO Server environment:java.io.tmpdir=C:\Users\User\AppData\Local\Temp\ (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,544] INFO Server environment:java.compiler=<NA> (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,553] INFO Server environment:os.name=Windows 7 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,556] INFO Server environment:os.arch=amd64 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,559] INFO Server environment:os.version=6.1 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,561] INFO Server environment:user.name=User (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,565] INFO Server environment:user.home=C:\Users\User (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,567] INFO Server environment:user.dir=C:\kafka_2.12-2.4.1 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,570] INFO Server environment:os.memory.free=497MB (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,573] INFO Server environment:os.memory.max=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,575] INFO Server environment:os.memory.total=512MB (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,582] INFO minSessionTimeout set to 6000 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,582] INFO maxSessionTimeout set to 60000 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:01,585] INFO Created server with tickTime 3000 minSessionTimeout 6000 maxSessionTimeout 60000 datadir C:\kafka_2.12-2.4.1\data\zookeeper\version-2 snapdir C:\kafka_2.12-2.4.1\data\zookeeper\version-2 (org.apache.zookeeper.server.ZooKeeperServer)
[2020-04-02 17:47:22,614] ERROR Selector failed to open (org.apache.zookeeper.server.NIOServerCnxnFactory)
java.io.IOException: Unable to establish loopback connection
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.nio.ch.PipeImpl.<init>(Unknown Source)
    at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
    at java.nio.channels.Pipe.open(Unknown Source)
    at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
    at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
    at java.nio.channels.Selector.open(Unknown Source)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.<clinit>(NIOServerCnxnFactory.java:101)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.zookeeper.server.ServerCnxnFactory.createFactory(ServerCnxnFactory.java:133)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:142)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)
Caused by: java.net.ConnectException: Connection timed out: connect
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
    at java.nio.channels.SocketChannel.open(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source)
    ... 18 more
[2020-04-02 17:47:22,633] INFO Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory (org.apache.zookeeper.server.ServerCnxnFactory)
[2020-04-02 17:47:22,658] INFO Configuring NIO connection handler with 10s sessionless connection timeout, 1 selector thread(s), 4 worker threads, and 64 kB direct buffers. (org.apache.zookeeper.server.NIOServerCnxnFactory)
[2020-04-02 17:47:43,675] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: Unable to establish loopback connection
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.nio.ch.PipeImpl.<init>(Unknown Source)
    at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source)
    at java.nio.channels.Pipe.open(Unknown Source)
    at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source)
    at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source)
    at java.nio.channels.Selector.open(Unknown Source)
    at org.apache.zookeeper.server.NIOServerCnxnFactory$AbstractSelectThread.<init>(NIOServerCnxnFactory.java:128)
    at org.apache.zookeeper.server.NIOServerCnxnFactory$SelectorThread.<init>(NIOServerCnxnFactory.java:348)
    at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:681)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:143)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)
Caused by: java.net.ConnectException: Connection timed out: connect
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.Net.connect(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
    at java.nio.channels.SocketChannel.open(Unknown Source)
    at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source)
    ... 17 more
  1. I am using Kafka version kafka_2.12-2.4.1
  2. I have verified there is no firewall issue
  3. Verified that the port is free
  4. I have simply downloaded the tar, extracted it and modified dataDir property in zookeeper.properties file in config to point to a custom zookeeper folder
  5. Added kafka_2.12-2.4.1/bin/windows to environment variable
  6. Using zookeeper that is packaged with Kafka
  7. Using windows 7

I understand the connection is not getting established but I am not sure what I can do to make it run. Any help is appreciated. Thanks in advance.

1
Not sure whether you checked this solution: stackoverflow.com/questions/42547714/…Raj Chandra
@RajChandra Already tried that. But still does not work. I only get this at the beginning of the log along with the logs mentioned above: Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=trueNitin Pareek
This sounds suspicious "[2020-04-02 17:47:01,466] WARN config\zookeeper.properties is relative. Prepend .\ to indicate that you're sure! (org.apache.zookeeper.server.quorum.QuorumPeerConfig) ...... [2020-04-02 17:47:01,416] WARN Either no config or no quorum defined in config, running in standalone mode (org.apache.zookeeper.server.quorum.QuorumPeerMain)" Maybe you can specify absolute path to see if it helps?mazaneicha
@mazaneicha the properties file is definitely getting picked up since it has the dataDir and port details. The log says it tries to start server in the same port. Moreover the version-2 folder is getting creating in the path specified in dataDir.Nitin Pareek

1 Answers

0
votes

This is because of a lack of privilege of the user you are executing the script.

IF you are using the default directory c:\tmp\zookeeper you will find out that usually only Admin user can write on c:\ and create the folder tmp.

You have two options:

  1. Execute the script as Admin (won't recommend it)
  2. Repoint the zookeeper.config data dire to an existing folder;
  3. Create manually the tmp fodler on C:.

Hope this helps.