zookeeper啟動失敗的排錯
1.執行zkServer.sh start 後顯示:
JMX enabled by default
Using config:/home/hadoop/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
2.jps後發現沒有QuorumPeerMain程序
3.檢視zookeeper-3.4.5/data下的zookeeper-3.4.5.out,如果提示 binding to port 0.0.0.0/0.0.0.0:2181
ERROR [main:[email protected]] - Unexpected exception, exiting abnormally java.net.BindException: Address already in use
說明2181埠被佔用,通過netstat -nltp | grep 2181檢查是否已被佔用,如果有則把對應的程序kill掉(kill 程序的pid),然後再啟動zookeeper
4..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)