今天就跟大家聊聊有关启动zookeeper报错该怎么办,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
启动zookeeper报错:ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
场景:
1.给三台机器安装zookeeper集群报错:ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
2.环境描述
系统: CentOS 7.6
zookeeper版本: 3.4.6
安装目录: /opt/zookeeper-3.4.6
安装的用户: hadoop
zookeeper data目录: /opt/zookeeper-3.4.6/zookeepertmp --需要手动创建
zookeeper tmp目录: /opt/zookeeper-3.4.6/zookeepertmp/log --需要手动创建
三台机器主机名: note01、note02、note03
解决:
报错信息如下:
$ vi zookeeper.out 2019-03-31 22:48:53,422 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg 2019-03-31 22:48:53,447 [myid:] - INFO [main:QuorumPeerConfig@340] - Defaulting to majority quorums 2019-03-31 22:48:53,449 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:123) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) Caused by: java.lang.IllegalArgumentException: /opt/zookeeper-3.4.6/zookeepertmp/myid file is missing at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:350) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:119) ... 2 more Invalid config, exiting abnormally
1.网上反馈很多的是因为没有创建myid文件以及配置文件配错(尴尬,毕竟是新手);
2.从myid文件先入手,这个第一次启动的时候确实没有创建myid文件,分别在三台机器创建myid文件并写入机器id号
在note01创建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "1" > myid
在note02创建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "2" > myid
在note03创建myid
$ cd /opt/zookeeper-3.4.6/zookeepertmp
$ echo "3" > myid
3.把zookeeper data目录下除了log文件夹和myid外其他的文件和文件夹删除
$ rm zookeeper_server.pid -rf
$ rm zookeeper.out -rf
$ rm version-2 -rf
4.再检查zoo.cfg文件是否配置正确
最后发现最后的
server.1=note2:2888:3888
server.2=note3:2888:3888
server.3=note4:2888:3888
前面的主机名错误,正确的应该是
server.1=note02:2888:3888
server.2=note03:2888:3888
server.3=note04:2888:3888
5.再次尝试启动zookeeper
分别在三台机器执行启动命令
$ zkServer.sh start
分别在三台机器执行查看状态命令
$ zkServer.sh status
6.居然还报错,不应该啊!!!死马当活马医,重启一下机器
$ exit
# reboot
7.再次尝试启动zookeeper
分别在三台机器执行启动命令
$ zkServer.sh start
分别在三台机器执行查看状态命令
[hadoop@note03 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: leader
[hadoop@note04 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
[hadoop@note02 zookeepertmp]$ zkServer.sh status
JMX enabled by default
Using config: /opt/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: follower
看到这里证明zookeeper启动正常,搞定!!!
看完上述内容,你们对启动zookeeper报错该怎么办有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。