javaapache-kafkaapache-zookeeper

Unable to start Zookeeper server in Apache Kafka


I am in kafka_home/bin/windows (as suggested here). Then I get the same problem as here, where it suggests to launch the program from the kafka home. I get this error when launching from the windows folder:

INFO Reading configuration from: config/zookeeper.properties (org.apache.zookeeper.server.quorum.QuorumPeerConfig)
[2014-08-21 11:53:55,748] FATAL Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing config/zookeeper.properties
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:99)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76)
Caused by: java.lang.IllegalArgumentException: config/zookeeper.properties file is missing
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:94)
    ... 2 more
Invalid config, exiting abnormally

Does anybody know how to solve this?


Solution

  • The default location of the configuration file is specified with a relative path, config/zookeeper.properties.

    The directory tree of Kafka looks somewhat like this:

    bin/
      |
      +-- zookeeper-server-start.sh
      |
      +-- windows/
            |
            +-- zookeeper-server-start.bat
    config/
      |
      +-- zookeeper.properties
    

    So if you are literally inside the bin/windows/ directory and then run zookeeper-server-start.bat from there, the ZK startup script will effectively look for its configuration at bin/windows/config/zookeeper.properties, which doesn't exist.

    Take a look at the existing answer (Apache Kafka error on windows - Couldnot find or load main class QuorumPeerMain) for the correct command to launch the ZK startup script, where the example command line explicitly defines where to find the configuration file:

    $ cd bin/windows
    $ zookeeper-server-start.bat ../../config/zookeeper.properties
    
    # The below will NOT work (explanation is above)
    $ cd bin/windows
    $ zookeeper-server-start.bat