When installing zookeeper, you can view the process start, but the status display error: Error contacting service. It is probably not running

When installing zookeeper-3.3.2, it started normally and no error was reported, but when checking the status with zkServer.sh status, an error occurred, as follows:

JMX enabled by default
Using config: /hadoop/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

jps looks at the process, but finds that the process has started

7313 QuorumPeerMain


There are three solutions for searching information online:

1, open zkServer.sh to find status)

STAT=`echo stat | nc localhost $(grep clientPort “$ZOOCFG” | sed -e’s/.*=//’) 2> /dev/null| grep Mode`Add
-q between nc and localhost 1 (It is the number 1 instead of the letter l)
If it already exists, remove the
note: Because the zookeeper I use is version 3.4.5, there is no line at all in my zkServer.sh script file, so it does not take effect

2. Call sh zkServer.sh status to encounter this problem. Baidu and Google found that someone modified a parameter of nc in the sh script to solve the problem, but the call of nc was not found in the sh file of 3.4.5. The log directory specified in the configuration file was not created and caused an error. Manually add the directory and restart, and the problem is solved.
Note: I think it’s not a log issue, so this method is not tried at all.

3. Create a data directory, that is, create a myid file in the directory specified by dataDir in your zoo.cfg configuration file, and specify the id, change the id to server.1=localhost:2888:3888 in your zoo.cfg file 1. Just write 1 in the myid header.
Note: When I installed the second time, the myid file was not created in the directory specified by dataDir, and the error was also reported. After creating the myid file in the directory specified by dataDir, no error was reported.

4 Because the firewall is not turned off. Turn off the firewall:

  #View firewall status

   service iptables status 

  #Turn off the firewall
   service iptables stop    #View the
  startup status of the firewall
chkconfig iptables –list #Turn
  off the firewall and start
   chkconfig iptables off

 Note: I did not turn off the firewall at the beginning, but when I turned off the firewall it did not solve the problem.

5 The mapping relationship between host and ip is not established.

  The command to establish the mapping relationship between hosts and ip is vim /etc/hosts. Add the mapping relationship between each host and ip address at the end of the file.

  Note: Only after the mapping relationship is established, can the machines on the same network segment use the host name for file transfer. problem solved!

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *