Zookeeper启动失败(java.net.BindException: 地址已在使用)


[hadoop@DEV22 ~]$ opt/zookeeper-3.4.8/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/hadoop/opt/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@DEV22 ~]$ jps
8637 Jps
[hadoop@DEV22 ~]$ cat zookeeper.out 
2016-06-13 15:55:17,304 [myid:] - INFO  [main:QuorumPeerConfig@103] - Reading configuration from: /home/hadoop/opt/zookeeper-3.4.8/bin/../conf/zoo.cfg
2016-06-13 15:55:17,315 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: 192.168.0.72 to address: /192.168.0.72
2016-06-13 15:55:17,315 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: 192.168.0.83 to address: /192.168.0.83
2016-06-13 15:55:17,316 [myid:] - INFO  [main:QuorumPeer$QuorumServer@149] - Resolved hostname: 192.168.0.73 to address: /192.168.0.73
2016-06-13 15:55:17,316 [myid:] - INFO  [main:QuorumPeerConfig@331] - Defaulting to majority quorums
2016-06-13 15:55:17,321 [myid:1] - INFO  [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2016-06-13 15:55:17,321 [myid:1] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2016-06-13 15:55:17,321 [myid:1] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2016-06-13 15:55:17,331 [myid:1] - INFO  [main:QuorumPeerMain@127] - Starting quorum peer
2016-06-13 15:55:17,337 [myid:1] - INFO  [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181
2016-06-13 15:55:17,337 [myid:1] - ERROR [main:QuorumPeerMain@89] - Unexpected exception, exiting abnormally
java.net.BindException: 地址已在使用
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:463)
	at sun.nio.ch.Net.bind(Net.java:455)
	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:90)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:130)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
	at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)

端口被占用了,把2181端口改成别的就可以了

[hadoop@DEV22 ~]$ vi opt/zookeeper-3.4.8/conf/zoo.cfg 
[hadoop@DEV22 ~]$ opt/zookeeper-3.4.8/bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/hadoop/opt/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[hadoop@DEV22 ~]$ jps
8694 QuorumPeerMain
8728 Jps


PS:

以下针对不同版本的Linux系统检查防火墙的状态,及关闭防火墙:

---------------------------------------------------------------

Ubuntu(ubuntu-12.04-desktop-amd64

查看防火墙状态:ufw status

关闭防火墙:ufw disable

---------------------------------------------------------------

centos6.0

查看防火墙状态:service iptables status

关闭防火墙:chkconfig iptables off    #开机不启动防火墙服务

--------------------------------------------------------------

centos7.0(默认是使用firewall作为防火墙,如若未改为iptables防火墙,使用以下命令查看和关闭防火墙)

查看防火墙状态:firewall-cmd --state

关闭防火墙:systemctl stop firewalld.service



你可能感兴趣的:(Hadoop,大数据动物园)