Build zookeeper cluster environment, start zookeeper
[Root@node4 bin]#./zkserver.sh start
The results of the operation are as follows:
JMX enabled by default
Using config:/usr/zoo/zookeeper-3.4.5/bin/. /conf/zoo.cfg
Starting Zookeeper ... Started
Show that the start-up is successful, but it is not
[Root@node4 bin]#./zkserver.sh stuts
The results are as follows:
JMX enabled by default
Using config:/usr/zoo/zookeeper-3.4.5/bin/. /conf/zoo.cfg
Error Contacting service. It is probably not running.
It is visible that ZK did not successfully start
./zkserver.sh Start-foreground
The results are as follows:
JMX enabled by default Using config:/usr/zoo/zookeeper-3.4.5/bin/. /conf/zoo.cfg 2017-05-16 07:45:29,742 [myID:]-INFO [main:quorumpeerconfig@101]-Reading configuration from:/usr/zoo/z ookeeper-3.4.5/bin/.. /conf/zoo.cfg 2017-05-16 07:45:29,746 [myID:]-INFO [main:quorumpeerconfig@334]-defaulting to majority quorums 2017-05 -16 07:45:29,764 [Myid:1]-INFO [main:datadircleanupmanager@78]-Autopurge.snapretaincount set to 3 2017-05-16 07:45:29 , 764 [myid:1]-INFO [main:datadircleanupmanager@79]-Autopurge.purgeinterval set to 0 2017-05-16 07:45:29,764 [myid:1]
-INFO [main:datadircleanupmanager@101]-Purge task is not scheduled. 2017-05-16 07:45:29,787 [Myid:1]-INFO [main:quorumpeermain@127]-Starting quorum peer 2017-05-16-07:45:29,802 [myid:1] -Info [main:nioservercnxnfactory@94]-binding to port 0.0.0.0/0.0.0.0:2181 2017-05-16 07:45:29,833 [myid:1]-info [m AIN:QUORUMPEER@913]-Ticktime set to 2017-05-16 07:45:29,833 [myid:1]-INFO [main:quorumpeer@933]- Minsessiontimeout set to-1 2017-05-16 07:45:29,833 [myid:1]-INFO [main:quorumpeer@944]-Maxsessiontimeout set to-1 2017-05-16 07:45:29,834 [Myid:1]-INFO [main:quorumpeer@959]-initlimit set to ten 2017-05-16 07:45:29,865 [Myid:1]-in FO [main:quorumpeer@444]-Acceptedepoch not found! Creating with a reasonable default of 0. This should only happen at are upgrading your installation 2017-05-16 07:45:29,894 [myid:1]-INFO [Thread-1:quorum CNXMANAGER$LISTENER@486]-My election bind port:0.0.0.0/0.0.0.0:3888 2017-05-16 07:45:29,906 [myid:1]-INFO [QuorumPee R[MYID=1]/0:0:0:0:0:0:0:0:2181:QUORUMPEER@670]-looking 2017-05-16 07:45:29,908 [myid:1]-INFO [QuorumPeer[myid=1]/ 0:0:0:0:0:0:0:0:2181:FASTLEADERELECTION@740]-New election. My id = 1, proposed zxid=0x0 2017-05-16 07:45:29,915 [myid:1]-INFO [workerreceiver[myid=1]:fastleaderelection@542]-N Otification:1 (N.leader), 0x0 (N.ZXID), 0x1 (N.round), looking (n.state), 1 (n.sid), 0x0 (N.peerepoch), looking (myState) 2017-05-16 07:45:29,928 [myid:1]-WARN [workersender[myid=1]:quorumcnxmanager@368]-Cannot open channel to 2 at Election address/192.168.0.113:3888 Java.net.NoRouteToHostException: No route to host unreachable at Java.net.PlainSocketImpl.socketConnect (Native method) at Java.net.AbstractPlainSocketImpl.doConnect ( abstractplainsocketimpl.java:350) at Java.net.AbstractPlainSocketImpl.connectToAddress (
abstractplainsocketimpl.java:206) at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:188) At Java.net.SocksSocketImpl.connect (sockssocketimpl.java:392) at Java.net.Socket.connect (socket.java:589) at Org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne (quorumcnxmanager.java:354) at Org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend (quorumcnxmanager.java:327) at Org.apache.zookeeper.server.quorum.fastleaderelection$messenger$workersender.process (FastLeaderElection.java : 393) at Org.apache.zookeeper.server.quorum.fastleaderelection$messenGer$workersender.run (fastleaderelection.java:365) at Java.lang.Thread.run (thread.java:745) 2017-05-16 07:45:29,973 [Myid:1]-WARN [workersender[myid=1]:quorumcnxmanager@368]-Cannot open channel to 3 at election address/192.168.0.114 : 3888
or use the following command to view ZK's startup parameters:
More importantly, it can be viewed through the Zookeeper boot log, in/zookeeper-3.4.5/bin
Root@node5 bin]# cat zookeeper.out 2017-05-16 07:42:10,739 [myID:]-INFO [main:quorumpeerconfig@101]-Reading Configur ation from:/usr/zoo/zookeeper-3.4.5/bin/. /conf/zoo.cfg 2017-05-16 07:42:10,743 [myID:]-INFO [main:quorumpeerconfig@334]-defaulting to majority quorums 2017-05 -16 07:42:10,758 [Myid:3]-INFO [main:datadircleanupmanager@78]-Autopurge.snapretaincount set to 3 2017-05-16 07:42:10 , 759 [Myid:3]-INFO [main:datadircleanupmanager@79]-Autopurge.purgeinterval set to 0 2017-05-16 07:42:10,759 [myid:3]
-INFO [main:datadircleanupmanager@101]-Purge task is not scheduled. 2017-05-16 07:42:10,778 [Myid:3]-INFO [main:quorumpeermain@127]-Starting quorum peer 2017-05-16-07:42:10,793 [Myid:3] -Info [main:nioservercnxnfactory@94]-binding to port 0.0.0.0/0.0.0.0:2181 2017-05-16 07:42:10,819 [myid:3]-info [m AIN:QUORUMPEER@913]-Ticktime set to 2017-05-16 07:42:10,819 [Myid:3]-INFO [main:quorumpeer@933]-Minsessiontime Out set to-1 2017-05-16 07:42:10,819 [Myid:3]-info [main:quorumpeer@944]-maxsessiontimeout set to-1 2017-05-16 07:42:10,819 [myid:3]-Info [main : quorumpeer@959]-initlimit set to ten 2017-05-16 07:42:10,842 [Myid:3]-INFO [main:quorumpeer@444]-Acceptedepoch not found! Creating with a reasonable default of 0. This should only happen at are upgrading your installation 2017-05-16 07:42:10,855 [Myid:3]-INFO [Thread-1:quorum CNXMANAGER$LISTENER@486]-My election bind port:0.0.0.0/0.0.0.0:3888 2017-05-16 07:42:10,867 [Myid:3]-INFO [QuorumPee R[MYID=3]/0:0:0:0:0:0:0:0:2181:QUORUMPEER@670]-looking 2017-05-16 07:42:10,868 [myid:3]-INFO [QuorumPeer[myid=3]/ 0:0:0:0:0:0:0:0:2181:FASTLEADERELECTION@740]-New election. My id = 3, proposed zxid=0x0 2017-05-16 07:42:10,877 [Myid:3]-WARN [workersender[myid=3]:quorumcnxmanager@368]-Canno
T open Channel to 1 at election address/192.168.0.112:3888 Java.net.NoRouteToHostException: no route to host (host unreachable) At Java.net.PlainSocketImpl.socketConnect(Native method) at Java.net.AbstractPlainSocketImpl.doConnect (abstractplainsocketimpl.java:350) at Java.net.AbstractPlainSocketImpl.connectToAddress (abstractplainsocketimpl.java:206) at Java.net.AbstractPlainSocketImpl.connect (abstractplainsocketimpl.java:188) at Java.net.SocksSocketImpl.connect ( sockssocketimpl.java:392) at Java.net.Socket.connect (socket.java:589) at Org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne (quorumcnxmanager.java:354) at Org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend (quorumcnxmanager.java:327) at Org.apache.zookeeper.server.quorum.fastleaderelection$messenger$workersender.process (FastLeaderElection.java : 393) at Org.apache.zookeeper.server.quorum.fastleaderelection$messenger$workersender.run ( fastleaderelection.java:365) at Java.lang.Thread.run (thread.java:745) 2017-05-16 07:42:11,882 [Myid:3]-WARN [ WORKERSENDER[MYID=3]:QUORUMCNXMANAGER@368]-Cannot open channel to 2 at election address/192.168.0.113:3888
Based on the above error prompts, locate the solution:
1, zookeeper cluster between the leader and follower ping different
2, Firewall is closed
The following is a review of the state of the firewall for different versions of the Linux system and the firewall shutdown:
---------------------------------------------------------------
Ubuntu (UBUNTU-12.04-DESKTOP-AMD64)
View firewall status: UFW status
Shutdown Firewall: UFW disable
---------------------------------------------------------------
centos6.0
View firewall Status: Service iptables status
Shutdown firewall: chkconfig iptables off #开机不启动防火墙服务
--------------------------------------------------------------
centos7.0 (default is to use firewall as a firewall, if not changed to iptables firewall, use the following command to view and close the firewall)
View firewall status: Firewall-cmd--state
Shutdown firewall: Systemctl stop Firewalld.service
Mine is CENTOS7, but use the service iptables status and other CENTOS6 commands to check and close the firewall, resulting in the firewall is not actually shut down, and therefore the above error