zookeeper + Kafka - Unable to create data directory

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)


You probably don't have permission to write to the directory log.dirs (see zookeeper.properties). Change the directory to a different one, change the permission setting of the current log.dirs directory or run Kafka as different user. You can use the command ls -l /var/zookeeper to see the current permissions and then chmod to change the permissions.


I got this problem for this setting on Windows PC:

dataDir=c:/data/zoo/

and thus this error:

2016-12-02 15:29:25,327 [myid:] - ERROR [main:ZooKeeperServerMain@64] - Unexpected exception, exiting abnormally
java.io.IOException: Unable to create data directory ??:\data\zoo\version-2

Problem was solved by changing (I have ZooKeeper on C disk unpackaged)

dataDir=/data/zoo/

Also run command line tool as Administrator if needed