zooKeeper学习(一)

最近在研究kafka,然后kafka又依赖于zookeeper,那么我就又顺带研究了zookeeper。记录一下zookeeper在安装遇到的问题。

在修改zoo.cfg 这个配置文件的时候,我是这样做的:

dataDir="D:\\zookeeper-3.4.8\\data"

加了双引号,其结果就是启动闪退。报错

2017-08-24 17:44:12,048 [myid:] - ERROR [main:ZooKeeperServerMain@63] - Unexpect
ed exception, exiting abnormally
java.io.IOException: Unable to create data directory "D:\zookeeper-3.4.8\data"\v
ersion-2
        at org.apache.zookeeper.server.persistence.FileTxnSnapLog.<init>(FileTxn
SnapLog.java:85)
        at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeep
erServerMain.java:104)
        at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooK
eeperServerMain.java:86)
        at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerM
ain.java:52)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(Qu
orumPeerMain.java:116)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain
.java:78)

查找了很多资料,都没有解决的办法,当时也看到一个英文的报错跟我一样,只不过他是在linux下没有权限,这个只需要修改一下创建文件夹的权限就可以了。那后来我是怎么解决的呢?我把双引号去掉了,再点击zkServer.cmd启动,没有报错。在此记录一下,免得后人踩坑。顺便提一下,闪退话,你可以用编辑器打开zkServer.cmd这个文件,在最后一行加上pause,这样就不会闪退,你就可以看到报错日志了。我也贴上来吧。

@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements.  See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License.  You may obtain a copy of the License at
REM
REM     http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.

setlocal
call "%~dp0zkEnv.cmd"

set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
echo on
call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*

endlocal
pause
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值