Zookeeper cluster startup
Error contacting service. It is probably not running.
2. Print the log. Look at the error. All nodes report this error.
tail -1000f zookeeper.out
2016-04-27 01:22:50,087 [myid:1] — INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@149] — Resolved hostname: node2.vvshop.cc to address: node2.vvshop.cc/54.254.152.81
2016-04-27 01:22:50,088 [myid:1] — WARN [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@400] — Cannot open channel to 3 at election address node3.vvshop.cc/52.221.223.222:3888
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
2016-04-27 01:22:50,319 [myid:1] — INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:QuorumPeer$QuorumServer@149] — Resolved hostname: node3.vvshop.cc to address: node3.vvshop.cc/52.221.223.222
2016-04-27 01:22:50,319 [myid:1] — INFO [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@852] — Notification time out: 60000
3. Find solutions online
1.http://freeman983.iteye.com/blog/2053037 log directory is not created and causes an error Not a reason.
2.http://blog.csdn.net/qianggezhishen/article/details/49363349 (My configuration is correct, but I still get an error)
The solution to the various strange problems encountered when using ZooKeeper installation:
1.nohup:failed to run command ‘Java’: No such file or directory
2.Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
a. Check if the number of the myid file is correct with the configuration.
b. Check if the myid file has been copied to the path of the dataDIr configuration.
c. Check if /etc/profile and /etc/environment set the path to Java and Zookeeper
d. Zookeeper cluster nodes must be more than 3
3. Still force stackoverflow found the solution:
server.1=0.0.0.0:2888:3888 server.2=192.168.10.10:2888:3888 server.3=192.168.2.1:2888:3888
Election address что это за программа
Start zookeeper error:
2017-05-31 12:12:38,740 [myid:3] — INFO [ListenerThread:QuorumCnxManager$Listener@534] — My election bind port: nhs-3/192.168.0.33:3888
2017-05-31 12:12:38,741 [myid:3] — ERROR [nhs-3/192.168.0.33:3888:QuorumCnxManager$Listener@547] — Exception while listening
java.net.BindException: Cannot assign requested address (Bind failed)
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.bind(ServerSocket.java:329)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:537)
2017-05-31 12:12:38,749 [myid:3] — INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:QuorumPeer@774] — LOOKING
2017-05-31 12:12:38,750 [myid:3] — INFO [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@818] — New election. My proposed zxid=0x0
2017-05-31 12:12:38,754 [myid:3] — WARN [WorkerSender[myid=3]:QuorumCnxManager@400] — Cannot open channel to 1 at election address nhs-1/192.168.0.27:3888
java.net.ConnectException: Connection refused (Connection refused)
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:381)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:354)
at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:452)
at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:433)
at java.lang.Thread.run(Thread.java:748)
solve:
How have defined the ip of the local server in each node? If you have given the public ip, then the listener would have failed to connect to the port. You must specify 0.0.0.0 for the current node
server.1=0.0.0.0:2888:3888 server.2=192.168.10.10:2888:3888 server.3=192.168.2.1:2888:3888
This change must be performed at the other nodes too.
При подготовке материала использовались источники:
https://www.programmersought.com/article/1997217235/
https://www.programmersought.com/article/81062446258/