you have to add a "myid" file in the dataDir that is defined in your
(From zookeeper docu: "The myid file consists of a single line containing
only the text of that machine's id. So myid of server 1 would contain the
text "1" and nothing else. The id must be unique within the ensemble and
should have a value between 1 and 255.") This file is needed that the node
knows its own identity.
So you need to myid files (one for each zookeeper node).
And because you need too different myid files, you also need two different
zoo.cfg files. And set two different dataDirs in there.
Hope this helps,
2012/6/27 Pedro Costa <[EMAIL PROTECTED]>
> I'm trying to configure 2 instances of zookeeper in the same machine. My
> zoo.cfg is
> # The number of milliseconds of each tick
> # The number of ticks that the initial
> # synchronization phase can take
> # The number of ticks that can pass between
> # sending a request and getting an acknowledgement
> # the directory where the snapshot is stored.
> # do not use /tmp for storage, /tmp here is just
> # example sakes.
> # the port at which the clients will connect
> # Be sure to read the maintenance section of the
> # administrator guide before turning on autopurge.
> # The number of snapshots to retain in dataDir
> # Purge task interval in hours
> # Set to "0" to disable auto purge feature
> But I got this error:
> 2012-06-27 10:06:36,322 [myid:] - INFO [main:QuorumPeerConfig@101] -
> Reading configuration from: /home/xeon/zookeeper/bin/../conf/zoo.cfg
> 2012-06-27 10:06:36,328 [myid:] - WARN [main:QuorumPeerConfig@287] - No
> server failure will be tolerated. You need at least 3 servers.
> 2012-06-27 10:06:36,328 [myid:] - INFO [main:QuorumPeerConfig@334] -
> Defaulting to majority quorums
> 2012-06-27 10:06:36,329 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid
> config, exiting abnormally
> org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error
> processing /home/xeon/zookeeper/bin/../conf/zoo.cfg
> Caused by: java.lang.IllegalArgumentException: /tmp/zookeeper/myid file is
> ... 2 more
> Invalid config, exiting abnormally
> How do I configure two instances of zookeeper in the same machine?
> Best regards,