答复: Starting zookeeper in replicated mode

2010-06-21 Thread Joe Zou
Hi:
You miss the file.
the Caused by: java.lang.IllegalArgumentException: /var/zookeeper/myid file is 
missing
at
thanks
Joe Zou
-邮件原件-
发件人: Erik Test [mailto:erik.shi...@gmail.com] 
发送时间: Tuesday, June 22, 2010 3:05 AM
收件人: zookeeper-user@hadoop.apache.org
主题: Starting zookeeper in replicated mode

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


Re: Starting zookeeper in replicated mode

2010-06-21 Thread Andrei Savu
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  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/


Re: Delivery Status Notification (Failure)

2010-06-21 Thread Erik Test
 Ahhh. Sorry I was making a very obvious mistake.

Unfortunately I'm still having problems probably because of another obvious
mistake.

The ZK servers are unable to connect to each other when I try to run
zkServer.sh start on master1 (myid = 1). The connection is being refused by
slave2 (myid = 2). I've tried stopping the server on slave2 and then
starting master1 but this doesn't work. I then tried running slave2 in
standalone mode, change slave2's config to match master1's config and then
tried running master1 but that doesn't work either. The connection is
refused in both cases.

Shouldn't I be able to start the server's I need just from one machine?
Erik



On 21 June 2010 15:15, Luka Stojanovic  wrote:

> Relevant part:
>
>
>  Caused by: java.lang.IllegalArgumentException: /var/zookeeper/myid file
is
>> missing
>>
>
> so every node should have that file, and its content should be id of the
> current node. In your case on machine master1 you should do
>
>  echo 1 > /var/zookeeper/myid
>
> 2 for slave1, etc...
>
> Cheers,
> Luka
>


Re: Starting zookeeper in replicated mode

2010-06-21 Thread Luka Stojanovic

Relevant part:

Caused by: java.lang.IllegalArgumentException: /var/zookeeper/myid file  
is

missing


so every node should have that file, and its content should be id of the  
current node. In your case on machine master1 you should do


  echo 1 > /var/zookeeper/myid

2 for slave1, etc...

Cheers,
Luka


Starting zookeeper in replicated mode

2010-06-21 Thread Erik Test
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


Re: is ZK client thread safe

2010-06-21 Thread Benjamin Reed

yes. (except for the single threaded C-client library :)

ben

On 06/17/2010 10:16 AM, Jun Rao wrote:

Hi,

Is ZK client thread safe? Is it ok for multiple threads sharing the same ZK
client? Thanks,

Jun