如果通过查询zookeeper的结点角色可以通过sh zkServer.sh status 执行

 

JMX enabled by default


Using config: /opt/zookeeper-3.3.3/bin/../conf/zoo.cfg

Error contacting service. It is probably not running.

出现上述问题的可能性有3种

 

1. 没有装nc

yum install nc 或者apt-get install nc,

或者下载netcat的包,本文也有连接,

安装步骤:

a. tar -zxvf netcat***.tar.gz

b. ./configure

c. make

d. make install

OK

 

2. 打开zkServer.sh,找到

STAT=`echo stat | nc  localhost $(grep clientPort "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`

这行,加上或去掉-q 1(数字1而非字母l) 即可。

 

3. /etc/hosts里面没有配置localhost

 

第二个问题一般的机器都没有问题,但是有一种情况没有配置,通过模板导入的虚拟机。

在/etc/hosts里增加下面一行

 

127.0.0.1       localhost SDN-VM1

运行结果:

JMX enabled by default


Using config: /opt/zookeeper-3.3.3/bin/../conf/zoo.cfg


Mode: follower

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐