Search code examples
apache-kafkaapache-zookeeper

zookeeper + Kafka - Unable to create data directory


I´m using zookeeper 3.4.8 in single node and try to use kafka.

When I run this command:

zookeeper-server-start.sh /usr/local/kafka_2.9.2-0.8.2.2    /config/zookeeper.properties

I get the below error:

[2016-02-22 17:32:41,661] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: Unable to create data directory /var/zookeeper/version-2
    at org.apache.zookeeper.server.persistence.FileTxnSnapLog.<init>(FileTxnSnapLog.java:85)
    at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:104)
    at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:86)
    at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:52)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)

Any advice?


Solution

  • One reason could be the inappropriate path specified to zoo.config file. A lot of solutions on the web specifies the path as ":\zookeeper-3.4.7\data".

    Instead of the above mentioned format, specify the address as full path from your C: drive to the data folder. It worked for me. (Don't forget to put double slash \ instead of one in case you're on windows)