开发者社区> 问答> 正文

zookeeper 启动成功,zkServer.sh status 失败

杨冬芳 2016-07-13 16:30:17 3062
zhjhtst02@inas:/inas/zookeeper01/zookeeper-3.4.6/bin>./zkServer.sh status
JMX enabled by default
Using config: /inas/zookeeper01/zookeeper-3.4.6/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
zookeeper 版本3.4.6
jdk 1.6
linux

zookeeper本身使用没有任何问题,只是./zkServer.sh status 无法执行。
其他命令都可以正常使用
有人说是nc问题,但3.4.6这个版本没有nc的语句了,
有人说是防火墙问题,但是停止了防火墙也没有作用。

status)
# -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
clientPortAddress=grep "^[[:space:]]*clientPortAddress[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'
if ! [ $clientPortAddress ]
then
clientPortAddress="localhost"
fi
clientPort=grep "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'
STAT="$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
-cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \
$clientPortAddress $clientPort srvr 2> /dev/null \
| grep Mode
if [ "x$STAT" = "x" ]
then
echo "Error contacting service. It is probably not running."
exit 1
else
echo $STAT
exit 0
fi

应该是这里的脚步有问题,为什么"x$STAT" = "x" 会成立,

Java Linux 网络安全 Perl
分享到
取消 提交回答
全部回答(1)
  • 杨冬芳
    2019-07-17 19:55:46

    ZooKeeper3.3.6 启动失败这里有个Zookeeper的入门指南,挺不错的

    0 0

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题