One of the solutions to zookeeper startup failure

When practicing hadoop setup, when zookeeper was started on the three virtual machines, the first and second were successfully started, and the third failed. This shows that there is no problem with the configuration file, and it should be a problem with the host.

The following figure shows the error displayed by starting zookeeper, and after jps, QuorumPeerMain does not appear.
Failure display
Enter the following sentence to display the specific cause of the error

/opt/modules/apache-zookeeper-3.6.0-bin/bin/zkServer.sh start-foreground

Insert picture description here
This should be the reason why the port is occupied. 2181 is the default port of zookeeper.
If you are a non-root user, first go to the root user:

[hadoop@host3 apache-zookeeper-3.6.0-bin]$ su root
Password: 
[root@host3 apache-zookeeper-3.6.0-bin]# netstat -lnp|grep 2181
tcp6       0      0 :::2181                 :::*                    LISTEN      1164/java     

Found that port 2181 is occupied, kill the process

[root@host3 apache-zookeeper-3.6.0-bin]# kill -9 1164

Check again that the port is unoccupied and
return to the original user, and successfully start zookeeper:

[root@host3 apache-zookeeper-3.6.0-bin]# su hadoop
[hadoop@host3 apache-zookeeper-3.6.0-bin]$ /opt/modules/apache-zookeeper-3.6.0-bin/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/modules/apache-zookeeper-3.6.0-bin/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@host3 apache-zookeeper-3.6.0-bin]$ jps
2194 Jps
2153 QuorumPeerMain

Guess you like

Origin blog.csdn.net/qq_42946328/article/details/113865290