zookeeper启动报错:java.io.IOException: Unable to create data directory:xxxxxxx

下载解压完zookeeper之后,修改了config目录下,新添加了一个文件zoo.cfg,将其中的dataDir=C:\\Users\\tools\\zookeeper\\logs
但是启动一直报下面的错误:

java.io.IOException: Unable to create data directory /var/zookeeper/version-2
    at org.apache.zookeeper.server.persistence.FileTxnSnapLog.(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)

解决办法:使用administrator运行cmd,在启动zookeeper问题消失。

每次都以管理员权限启动会很麻烦,比较好的做法是修改当前用户对这个文件夹的访问权限流程如下:

对不能写入的文件夹点击 右键 -> 属性 -> 安全 -> 编辑
找到你的当前用户
在下方修改此用户对该文件的读写权限

zookeeper启动报错:java.io.IOException: Unable to create data directory:xxxxxxx_第1张图片

 

 

你可能感兴趣的:(云计算)