执行zkServer.sh start 后显示:

JMX enabled by default
Using config:/home/hadoop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED


1、jps后发现没有QuorumPeerMain进程

1.1 查看zookeeper-3.4.5/data下的zookeeper-3.4.5.out,如果提示 binding to port 0.0.0.0/0.0.0.0:2181

ERROR [main:QuorumPeerMain@89] - Unexpected exception, exiting abnormally java.net.BindException: Address already in use

说明2181端口被占用,通过netstat -nltp | grep 2181检查是否已被占用,如果有则把对应的进程kill掉(kill 进程的pid),然后再启动zookeeper

1.2 查看是不是/soft/zookeeper/data/myid 没有配置

 


2、jps后发现有QuorumPeerMain进程,然后执行zkServer.sh status,如果显示:

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

说明未启动成功,通过查看zookeeper-3.4.5.out,如果提示

Cannot open channel to 1 at election address hadoop05/10.37.129.105:3888
java.net.NoRouteToHostException: No route to host,说明无法连接远程电脑10.37.129.105:3888,很有可能开启了防火墙

通过sudo service iptables status检查,如果确实开启,则通过sudo service iptables stop将其关闭,最后再查看状态zkServer.sh status

此时,基本都能够正常启动了,提示:

JMX enabled by default
Using config: /home/hadoop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: leader(或follower)
 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐