Apache zookeeper Zookeeper-三个节点,只有错误

Apache zookeeper Zookeeper-三个节点,只有错误,apache-zookeeper,Apache Zookeeper,我有三个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 bet

我有三个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

您需要创建一个名为myid的文件,并将其放入zookeeper var目录,每个服务器一个目录,由一行组成,其中只包含该机器id的文本。因此,服务器1的myid将包含文本“1”,而不包含任何其他内容。id在集合中必须是唯一的,并且其值应介于1和255之间

更多信息请访问

您的服务器和IP

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

如果将值“1”放在myid文件中,则会出现数字格式异常,如果myid文件是以任何扩展名创建的,则会出现“配置无效,异常退出”


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

噢……明白了。你把tat文件放在哪里/etc/zookeeper/conf?将文件放在zookeeper.properties中“dataDir”属性标识的位置(反过来,它是启动zookeeper时作为参数传递的文件)。在上面的配置文件中,dataDir是/var/lib/zookeper,因此该文件应该是/var/lib/zookeper/myid。
server.1=111.111.111:2888:3888
server.2=111.111.112:2888:3888
server.3=111.111.113:2888:3888