Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # user >> 2 instances of zookeeper in the same machine.


Copy link to this message
-
Re: 2 instances of zookeeper in the same machine.
Take a look at zkconf: https://github.com/phunt/zkconf

Patrick

On Wed, Jun 27, 2012 at 2:50 AM, Hartmut Lang
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> you have to add a "myid" file in the dataDir that is defined in your
> zoo.cfg.
> (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,
> Hartmut
>
>
> 2012/6/27 Pedro Costa <[EMAIL PROTECTED]>
>
>> Hi,
>>
>> I'm trying to configure 2 instances of zookeeper in the same machine. My
>> zoo.cfg is
>>
>> # The number of milliseconds of each tick
>> tickTime=2000
>> # 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.
>> # do not use /tmp for storage, /tmp here is just
>> # example sakes.
>> dataDir=/tmp/zookeeper
>> # the port at which the clients will connect
>> clientPort=2181
>> #
>> # Be sure to read the maintenance section of the
>> # administrator guide before turning on autopurge.
>> #
>> #
>> http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
>> #
>> # The number of snapshots to retain in dataDir
>> #autopurge.snapRetainCount=3
>> # Purge task interval in hours
>> # Set to "0" to disable auto purge feature
>> #autopurge.purgeInterval=1
>> server.1=localhost:2888:3888
>> server.2=localhost:2889:3889
>>
>> 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
>>        at
>>
>> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:121)
>>        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:344)
>>        at
>>
>> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:117)
>>        ... 2 more
>> Invalid config, exiting abnormally
>>
>> How do I configure two instances of zookeeper in the same machine?
>> --
>> Best regards,
>>