错误代码如下

2020-07-04 20:47:19,800 [myid:] - INFO  [main:QuorumPeerConfig@134] - Reading configuration from: /usr/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
2020-07-04 20:47:19,821 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: slave2 to address: slave2/192.168.80.130
2020-07-04 20:47:19,821 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: slave1 to address: slave1/192.168.80.129
2020-07-04 20:47:19,822 [myid:] - INFO  [main:QuorumPeer$QuorumServer@167] - Resolved hostname: master to address: master/192.168.80.128
2020-07-04 20:47:19,822 [myid:] - INFO  [main:QuorumPeerConfig@396] - Defaulting to majority quorums
2020-07-04 20:47:19,822 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /usr/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
	at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:154)
	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: serverid  is not a number
	at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:420)
	at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:150)
	... 2 more
Invalid config, exiting abnormally

解决方案:
在安装zookeeper之前,修改hosts文件

vim /etc/hosts

在原有基础上添加主机名称到IP地址映射
即添加:

master.root
slave1.root
slave2.root

如下所示

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.80.128 master master.root
192.168.80.129 slave1 slave1.root
192.168.80.130 slave2 slave2.root

之后可以正常启动
在这里插入图片描述

Logo

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

更多推荐