解决ZooKeeper配置中出现Error contacting service. It is probably not running

前言

Linux版本:CentOS-6.7-x86_64-bin-DVD1.iso  (链接:点击打开链接 密码:h51u)

JDK版本:1.8 (JDK安装过程参考:点击打开链接)

ZooKeeper版本:3.4.6 (ZooKeeper安装教程参考:点击打开链接)

报错过程

通过命令zkServer.sh start之后,显示STARTED

上面的结果看似已经启动了,但是,我们再用命令zkServer.sh status查看状态时,却出现了下面的信息:

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第1张图片

报了错:Error contacting service. It is probably not running.

这说明并没有启动成功!

问题分析

我们可以通过bin目录下面的zookeeper.out来查看问题原因

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第2张图片

java.lang.IllegalArgumentException: /usr/local/zookeeper/data/myid file is missing

这上面说的是myid文件缺失!但是我明明已经加了啊,为什么还会报这样的错呢????

问题解决

这时候,我想到了之前我添加了3台服务器:

可能涉及到Leader(Master)选举的问题,需要先启动master,然后再启动follower

于是,我把三台机器都启动了,到最后才用zkServer.sh status查看状态!

果然!!!!

都启动成功了!!!!!

server.2是leader,另外两个都是follower!!!!!!

leader:

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第3张图片

follower:

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第4张图片

follower:

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第5张图片

呵呵哒!!!这个本来没什么问题,三台机器启动之后再看状态就好啦!!!

OK, GAME OVER!

 

更多内容,请关注公众号:程序员高手之路

在公众号回复:linux   即可免费获取linux视频教程(未加密)!

 解决ZooKeeper配置中出现Error contacting service. It is probably not running_第6张图片

解决ZooKeeper配置中出现Error contacting service. It is probably not running_第7张图片

你可能感兴趣的:(ZooKeeper,Linux技术)