问题描述
启动zookeeper时,感觉一切正常,但是通过zkServer.sh status查看状态时,发现报错:
Error contacting service. It is probably not running.
通过查看 zk/logs下的文件,发现有如下报错:
ERROR [main:QuorumPeerMain@86] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Address unresolved: node01:3888
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.<init>(QuorumPeer.java:242)
at org.apache.zookeeper.server.quorum.flexible.QuorumMaj.<init>(QuorumMaj.java:89)
错误原因
在配置zoo.cfg文件时候,端口号后面还有空格。因为是从其他地方复制的,所以不容易发现
server.0=spark1:2888:3888(此处有空格)
server.1=spark2:2888:3888
server.2=spark3:2888:3888
解决办法:
删掉端口号后面的空格即可