IllegalArgumentException:缺少/ tmp / zookeeper / myid文件

时间:2017-03-22 08:28:45

标签: amazon-ec2 apache-kafka apache-zookeeper

我正在尝试按照this gist在多个EC2实例上配置Kafka,但我收到以下错误:

我正在运行此命令:

$ bin/zookeeper-server-start.sh config/zookeeper.properties &

1 13308

错误

[2017-03-22 08:21:00,314] ERROR Invalid config, exiting abnormally (org.apache.zookeeper.server.quorum.QuorumPeerMain)
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing config/zookeeper.properties
    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: /tmp/zookeeper/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

我的zookeeper.conf如下所示:

dataDir=/tmp/zookeeper
# the port at which the clients will connect
#clientPort=2181
clientPort=2080
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0


server.1=ec2-<GLOBAL_IP_1>.amazonaws.com:2888:3888
server.2=ec2-<GLOBAL_IP_2>.amazonaws.com:2888:3888
#add here more servers if you want
initLimit=5
syncLimit=2
tickTime=2000

1 个答案:

答案 0 :(得分:5)

  

当服务器启动时,它通过查找知道它是哪个服务器   数据目录中的文件myid

myid下创建一个名为dataDir的文件,即/tmp/zookeeper为每个Zookeeper服务器。

myid文件应包含相应的服务器编号,ASCII格式(例如1),作为其唯一条目。