【问题标题】:Zookeeper - three nodes and nothing but errorsZookeeper - 三个节点,只有错误
【发布时间】:2012-07-14 22:59:54
【问题描述】:

我有三个 zookeeper 节点。所有端口都是开放的。 ip地址是正确的。下面是我的配置文件。由 Chef 启动的所有节点都具有相同的安装和配置文件。

# The number of milliseconds of each tick
tickTime=3000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
dataDir=/var/lib/zookeeper
# Place the dataLogDir to a separate physical disc for better performance
# dataLogDir=/disk2/zookeeper

# the port at which the clients will connect
clientPort=2181

server.1=111.111.111:2888:3888
server.2=111.111.112:2888:3888
server.3=111.111.113:2888:3888

这是其中一个节点的错误。所以......我对如何得到错误感到很困惑,因为配置相当普通。所有三个节点都在做同样的事情。

2012-07-16 05:16:57,558 - INFO  [main:QuorumPeerConfig@90] - Reading configuration from: /etc/zookeeper/conf/zoo.cfg
2012-07-16 05:16:57,567 - INFO  [main:QuorumPeerConfig@310] - Defaulting to majority quorums
2012-07-16 05:16:57,572 - FATAL [main:QuorumPeerMain@83] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /etc/zookeeper/conf/zoo.cfg
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:99)
    at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76)
Caused by: java.lang.IllegalArgumentException: serverid replace this text with the cluster-unique zookeeper's instance id (1-255) is not a number
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:333)
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106)
    ... 2 more

【问题讨论】:

    标签: apache-zookeeper


    【解决方案1】:

    您需要创建一个名为 myid 的文件并将其放入 zookeeper var 目录中,每个服务器一个,包含仅包含该机器 id 文本的单行。因此,服务器 1 的 myid 将包含文本“1”,仅此而已。 id 在 ensemble 中必须是唯一的,并且应该具有介于 1 和 255 之间的值。

    http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html#sc_zkMulitServerSetup查看更多信息

    【讨论】:

    • 哦……知道了。你把tat文件放在哪里? /etc/zookeeper/conf?
    • 您将文件放置在由 zookeeper.properties 中的“dataDir”属性标识的位置(这又是您在启动 ZooKeeper 时作为参数传递的文件)。在上面的配置文件中,你的 dataDir 是 /var/lib/zookeeper,所以文件应该是 /var/lib/zookeeper/myid。
    【解决方案2】:
    server.1=111.111.111:2888:3888
    server.2=111.111.112:2888:3888
    server.3=111.111.113:2888:3888
    

    是你的服务器和 IP 的

    然后在目录(dataDir=/var/lib/zookeeper)下的111.111.111和111.111.111.112和111.111.111.113服务器的每个节点上创建值为1和2的myid文件(dataDir=/var/lib/zookeeper)

    如果您将值“1”的 myid 文件设置为带有任何扩展名的 myid 文件,则会出现数字格式异常和“无效配置,异常退出”。

    因此只需创建不带任何扩展名的 myid 文件,并将整数值 1,2,3 放在相应的服务器中,不带双引号

    【讨论】:

      猜你喜欢
      • 2012-10-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-29
      • 1970-01-01
      • 2017-11-11
      相关资源
      最近更新 更多