As Luka Stojanovic suggested you need to a a file called
/var/zookeeper/myid on each node:

$ echo 1,2 ... 6 > /var/zookeeper/myid

I want to make a few more comments related to your setup and to your questions:

- there is no configured master node in a zookeeper cluster. the
leader is automatically elected at runtime
- you can write and read from any node at any time

> Am I supposed to have an instance of ZooKeeper on each node started before 
> running in replication mode?
- you start the cluster by starting one node at a time

> Should I have each node that will be running ZK listed in the config file?
- yes. you need to have all nodes running ZK listed in the config file.

> Should I be using an IP address to point to a server instead of a hostname?
- it doesn't really make difference if you use hostnames or IP addresses.

I hope this will help you.

Andrei

On Mon, Jun 21, 2010 at 10:04 PM, Erik Test <erik.shi...@gmail.com> wrote:
> Hi All,
>
> I'm having a problem with installing zookeeper on a cluster with 6 nodes in
> replicated mode. I was able to install and run zookeeper in standalone mode
> but I'm unable to run zookeeper in replicated mode.
>
> I've added a list of servers in zoo.cfg as suggested by the ZooKeeper
> Getting Started Guide but I get these logs displayed to screen:
>
> *[r...@master1 bin]# ./zkServer.sh start
> JMX enabled by default
> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> Starting zookeeper ...
> STARTED
> [r...@master1 bin]# 2010-06-21 12:25:23,738 - INFO
> [main:quorumpeercon...@80] - Reading configuration from:
> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> 2010-06-21 12:25:23,743 - INFO  [main:quorumpeercon...@232] - Defaulting to
> majority quorums
> 2010-06-21 12:25:23,745 - FATAL [main:quorumpeerm...@82] - Invalid config,
> exiting abnormally
> org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error
> processing /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:100)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:98)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:75)
> Caused by: java.lang.IllegalArgumentException: /var/zookeeper/myid file is
> missing
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:238)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:96)
>        ... 2 more
> Invalid config, exiting abnormally*
>
> And here is my config file:
> *
> # The number of milliseconds of each tick
> tickTime=2000
> # The number of ticks that the initial
> # synchronization phase can take
> initLimit=5
> # The number of ticks that can pass between
> # sending a request and getting an acknowledgement
> syncLimit=2
> # the directory where the snapshot is stored.
> dataDir=/var/zookeeper
> # the port at which the clients will connect
> clientPort=2181
> server.1=master1:2888:3888
> server.2=slave2:2888:3888
> server.3=slave3:2888:3888
> *
> I'm a little confused as to why this doesn't work and I haven't had any luck
> finding answers to some questions I have.
>
> Am I supposed to have an instance of ZooKeeper on each node started before
> running in replication mode? Should I have each node that will be running ZK
> listed in the config file? Should I be using an IP address to point to a
> server instead of a hostname?
>
> Thanks for your time.
> Erik
>



-- 
Andrei Savu

http://www.andreisavu.ro/

Reply via email to