Problem description
Starting normally:
< span style="padding: 0px; margin: 0px; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background- clip: initial;">#zkServer.sh start
JMX enabled by default
Using config: /usr/local/zk/bin/../conf/zoo.cfg
Starting zookeeper… STARTED
Check the status but report an error:
# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zk/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.
Problem resolution
reason one
zoo.cfgWhen configuring the file, specifylog output directory, but it has not been created, it needs to be created by mkdir.
mkdir -p /usr/zookeeper/tmp
reason two
The myid file under the tmp directory is incorrectly written, above the different nodes The numbers in the myid are different, set respectively: 1, 2, 3 and so on.
< span style="font-size:18px">reason three
Is the firewall turned off (this is the biggest possibility)< /span>.
service iptables stop //Turn off the firewall
service iptables status //View status
chkconfig iptables off //Disable firewall
Ubuntu
Check firewall status: ufw status
Turn off the firewall: ufw disable
Centos7.0 p>
View firewall status: firewall-cmd –state
Turn off the firewall: systemctl stop firewalld.service< /p>
< /span>
reason four
zoo.cfgConfigure whether the host name of the node is wrong.
If yes, stop three nodes firstzookeeper Service, then modify the nodes one by onezoo.cfgConfiguration file< span style="font-family:Calibri">, thenstart one by one .
reason five
The port is occupied, put 2181 Just change the port to something else. .
netstat -an | grep 2181
< span style="font-family:Calibri">
reason six
Usejps command to check whether zk has been started, if it is started, kill the process first, and then restart it.
< span style="color:rgb(255,102,102); font-family:SimSun; font-size:18px">reason seven
Establish the mapping relationship between host and ip The command is vim /etc/hosts.