Zookeeper启动遇到的问题
root@slaver1:/usr/zookeeper/bin# ./zkServer.sh start JMX enabled by default Using config: /usr/zookeeper/bin/../conf/zoo.cfg Starting zookeeper ... STARTED root@slaver1:/usr/zookeeper/bin# ./zkServer.sh status JMX enabled by default Using config: /usr/zookeeper/bin/../conf/zoo.cfg Error contacting service. It is probably not running.
这是启动以及查看状态的代码,但是“It is probably not running.”的原因有很多,可以从zookeeper.out找出自己的问题
zookeeper.out的位置:
zookeeper/bin/ookeeper.out
打开后发现问题如下:
nohup: failed to run command ‘java’: No such file or directory
zkServer.sh文件开头添加如下内容:
export JAVA_HOME=/usr/java/jdk1.8.0_111 export PATH=${JAVA_HOME}/bin:$PATH #自己的java路径
问题解决,但是还有一点注意的就是,zookeeper至少需要三台server