错误日志如下:
[hadoop@master zookeeper-3.4.5-cdh5.10.0]$ cat zookeeper.out
2018-05-15 01:29:21,036 [myid:] - INFO [main:QuorumPeerConfig@101] - Reading configuration from: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
2018-05-15 01:29:21,045 [myid:] - INFO [main:QuorumPeerConfig@334] - Defaulting to majority quorums
2018-05-15 01:29:21,048 [myid:1] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-05-15 01:29:21,048 [myid:1] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-05-15 01:29:21,049 [myid:1] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-05-15 01:29:21,065 [myid:1] - INFO [main:QuorumPeerMain@132] - Starting quorum peer
2018-05-15 01:29:21,074 [myid:1] - INFO [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:2181
2018-05-15 01:29:21,076 [myid:1] - ERROR [main:QuorumPeerMain@94] - Unexpected exception, exiting abnormally
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:95)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:135)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:79)
如日志中红色字体所示,该错误是由于Zookeeper对应的端口号被占用导致的。
查看端口占用情况:
[hadoop@master zookeeper-3.4.5-cdh5.10.0]$ sudo netstat -nltp | grep 2181
tcp 0 0 :::2181 :::* LISTEN 3071/java
如上所示,占用Zookeeper对应端口号的应用是java,只需要kill掉该应用就能成功启动Zookeeper了。
[hadoop@master zookeeper-3.4.5-cdh5.10.0]$ sudo kill -9 3071
重启如下:
[hadoop@master zookeeper-3.4.5-cdh5.10.0]$ bin/zkServer.sh start
JMX enabled by default
Using config: /opt/modules/zookeeper-3.4.5-cdh5.10.0/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@master zookeeper-3.4.5-cdh5.10.0]$ jps
6481 Jps
5330 DataNode
5733 ResourceManager
5077 DFSZKFailoverController
6456 QuorumPeerMain
5225 NameNode
5514 JournalNode
5837 NodeManager
Zookeeper启动成功!
以上就是博主为大家介绍的这一板块的主要内容,这都是博主自己的学习过程,希望能给大家带来一定的指导作用,有用的还望大家点个支持,如果对你没用也望包涵,有错误烦请指出。如有期待可关注博主以第一时间获取更新哦,谢谢!
版权声明:本文为博主原创文章,未经博主允许不得转载。