zookeeper各种报错、原因分析解决办法

	
	 

		
[root@sxt zookeeper-3.4.10]# bin/zkCli.sh -server localhost:2181,localhost:2182,localhost:2183
Connecting to localhost:2181,localhost:2182,localhost:2183
log4j:WARN No appenders could be found for logger (org.apache.zookeeper.ZooKeeper).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Welcome to ZooKeeper!
JLine support is enabled
[zk: localhost:2181,localhost:2182,localhost:2183(CONNECTING) 0] create -s /[sPacktPub]
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
    at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:706)
    at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:599)
    at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:371)
    at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:331)
    at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:290)
[root@sxt  zookeeper-3.4.10]# ls /         

上述问题近发生在单机三节点模式时。
ZooKeeper自定义数据日志目录
ZooKeeper在启动时会将zookeeper.out输出到当前目录,不仅不友好,有时候可能会因为目录权限问题引发一些不必要的麻烦。
解决方案:
设置ZOO_LOG_DIR环境变量,也可以改在shell中写,如下:


if [ $ZOO_LOG_DIR ] ; then
export ZOO_LOG_DIR=/usr/local/zookeeper/logs
fi

if [ -z $ZOO_LOG_DIR ];then
export ZOO_LOG_DIR=/usr/local/zookeeper/logs
fi

conf/log4j.properties中定义:

zookeeper.log.dir=/usr/local/zookeeper/logs
zookeeper.tracelog.dir=/usr/local/zookeeper/logs

 curator KeeperErrorCode = Unimplemented异常

ZooKeeper 3.5.x


Curator 4.0 has a hard dependency on ZooKeeper 3.5.x
If you are using ZooKeeper 3.5.x there's nothing additional to do - just use Curator 4.0


ZooKeeper 3.4.x

Curator 4.0 supports ZooKeeper 3.4.x ensembles in a soft-compatibility mode. To use this mode you must exclude ZooKeeper when adding Curator to your dependency management tool.  

Curator 4.0默认不支持zk 3.4,必须兼容性处理,如下:


        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>3.4.12</version>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <version>4.0.0</version>
            <!-- 4.0.0原生不兼容zk 3.4, 必须进行兼容性处理 -->
            <exclusions>
                <exclusion>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                </exclusion>
            </exclusions>
        </dependency>    
        
        
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值