You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Erik Test <er...@gmail.com> on 2010/06/21 21:04:32 UTC

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:

*[root@master1 bin]# ./zkServer.sh start
JMX enabled by default
Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
Starting zookeeper ...
STARTED
[root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
[main:QuorumPeerConfig@80] - Reading configuration from:
/root/zookeeper-3.2.2/bin/../conf/zoo.cfg
2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting to
majority quorums
2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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

Posted by Sigehere <pe...@gmail.com>.
hello friend,
 i have done changes in iptables as follow:

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:3888
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:2888
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:2181
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:3888
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:2888
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:2181
ACCEPT     all  --  pc-ubuntu1204        swapnil-lp          
ACCEPT     all  --  swapnil-lp           pc-ubuntu1204       

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  


but my zookeeper replication is not working what is problem can you help me
please.
$ java -cp
zookeeper-3.4.5.jar:lib/slf4j-api-1.6.1.jar:lib/slf4j-log4j12-1.6.1.jar:lib/log4j-1.2.15.jar:conf
org.apache.zookeeper.server.quorum.QuorumPeerMain conf/zoo.cfg
2013-02-02 13:21:18,723 [myid:] - INFO  [main:QuorumPeerConfig@101] -
Reading configuration from: conf/zoo.cfg
2013-02-02 13:21:18,729 [myid:] - WARN  [main:QuorumPeerConfig@287] - No
server failure will be tolerated. You need at least 3 servers.
2013-02-02 13:21:18,729 [myid:] - INFO  [main:QuorumPeerConfig@334] -
Defaulting to majority quorums
2013-02-02 13:21:18,732 [myid:1] - INFO  [main:DatadirCleanupManager@78] -
autopurge.snapRetainCount set to 3
2013-02-02 13:21:18,732 [myid:1] - INFO  [main:DatadirCleanupManager@79] -
autopurge.purgeInterval set to 0
2013-02-02 13:21:18,732 [myid:1] - INFO  [main:DatadirCleanupManager@101] -
Purge task is not scheduled.
2013-02-02 13:21:18,769 [myid:1] - INFO  [main:QuorumPeerMain@127] -
Starting quorum peer
2013-02-02 13:21:18,781 [myid:1] - INFO  [main:NIOServerCnxnFactory@94] -
binding to port 0.0.0.0/0.0.0.0:2181
2013-02-02 13:21:18,794 [myid:1] - INFO  [main:QuorumPeer@913] - tickTime
set to 2000
2013-02-02 13:21:18,794 [myid:1] - INFO  [main:QuorumPeer@933] -
minSessionTimeout set to -1
2013-02-02 13:21:18,795 [myid:1] - INFO  [main:QuorumPeer@944] -
maxSessionTimeout set to -1
2013-02-02 13:21:18,795 [myid:1] - INFO  [main:QuorumPeer@959] - initLimit
set to 5
2013-02-02 13:21:18,804 [myid:1] - INFO  [main:FileSnap@83] - Reading
snapshot /home/hduser/zookeeperdata/version-2/snapshot.0
2013-02-02 13:21:18,810 [myid:1] - INFO 
[Thread-1:QuorumCnxManager$Listener@486] - My election bind port:
0.0.0.0/0.0.0.0:3888
2013-02-02 13:21:18,821 [myid:1] - INFO 
[QuorumPeer[myid=1]/0.0.0.0:2181:QuorumPeer@670] - LOOKING
2013-02-02 13:21:18,823 [myid:1] - INFO 
[QuorumPeer[myid=1]/0.0.0.0:2181:FastLeaderElection@740] - New election. My
id =  1, proposed zxid=0x0
2013-02-02 13:21:18,824 [myid:1] - INFO 
[WorkerReceiver[myid=1]:FastLeaderElection@542] - Notification: 1
(n.leader), 0x0 (n.zxid), 0x1 (n.round), LOOKING (n.state), 1 (n.sid), 0x1
(n.peerEPoch), LOOKING (my state)
2013-02-02 13:21:18,827 [myid:1] - WARN 
[WorkerSender[myid=1]:QuorumCnxManager@368] - Cannot open channel to 2 at
election address pc-ubuntu1204/192.168.2.2:3888
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
        at java.net.Socket.connect(Socket.java:546)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:354)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:327)
        at
org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:393)
        at
org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:365)
        at java.lang.Thread.run(Thread.java:679)
2013-02-02 13:21:19,027 [myid:1] - WARN 
[QuorumPeer[myid=1]/0.0.0.0:2181:QuorumCnxManager@368] - Cannot open channel
to 2 at election address pc-ubuntu1204/192.168.2.2:3888
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
        at java.net.Socket.connect(Socket.java:546)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:354)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:388)
        at
org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:765)
        at
org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:716)
2013-02-02 13:21:19,029 [myid:1] - INFO 
[QuorumPeer[myid=1]/0.0.0.0:2181:FastLeaderElection@774] - Notification time
out: 400
2013-02-02 13:21:19,431 [myid:1] - WARN 
[QuorumPeer[myid=1]/0.0.0.0:2181:QuorumCnxManager@368] - Cannot open channel
to 2 at election address pc-ubuntu1204/192.168.2.2:3888
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
        at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
        at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
        at java.net.Socket.connect(Socket.java:546)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:354)
        at
org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:388)
        at
org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:765)
        at
org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:716)

for other my setup information please visit:
http://zookeeper-user.578899.n2.nabble.com/Zookeeper-start-up-error-td7578471.html

Thanks in advance !!!



--
View this message in context: http://zookeeper-user.578899.n2.nabble.com/Starting-zookeeper-in-replicated-mode-tp5205720p7578472.html
Sent from the zookeeper-user mailing list archive at Nabble.com.

Re: 答复: Starting zookeeper in replicated mode

Posted by Erik Test <er...@gmail.com>.
Patrick,

I'm still fairly new to iptables. I've made changes to the iptables the way
I think it should be but the connection is still refused from 151.1 to
151.2. This is what I have tried in the iptables on 151.1. 151.2's firewall
is turned off.

-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -d 192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 3888 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 2888 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 2181 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -d 192.168.151.2 -s 192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -d 192.168.151.2 -p tcp --sport 3888 -s
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -d 192.168.151.2 -p tcp --sport 2888 -s
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -d 192.168.151.2 -p tcp --sport 2181 -s
192.168.151.1 -j ACCEPT

I also tried the iptable config below because the connection is being
refused on 151.2:3888 but this isn't working either.

-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -d 192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 3888 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 2888 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -s 192.168.151.2 -p tcp --dport 2181 -d
192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -d 192.168.151.2 -s 192.168.151.1 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 3888 -d 192.168.151.2 -s
192.168.151.1 -j ACCEPT

I think I read somewhere that ZK uses tcp for communications which is why
I'm specifying that protocol. But shouldn't specifying comms between two IP
addresses be good enough though?

Erik


On 22 June 2010 12:01, Patrick Hunt <ph...@apache.org> wrote:

> There are 3 ports that need to be opened
>
> 1) the client port (btw client and servers)
> 2/3) the quorum and election ports - only btw servers
>
> You are setting these three ports in your config file (clientport defaults
> to 2181 iirc, unless you override)
>
> Patrick
>
>
> On 06/22/2010 06:17 AM, Erik Test wrote:
>
>> Thanks for your help. The missing file issue is resolved.
>>
>> I was confused by how to start zookeeper because a firewall is blocking
>> connections between nodes. The odd thing is hadoop can run on its own with
>> the configured iptables but doesn't work with zookeeper for some reason.
>> The
>> problem here is I can't turn off the firewall and need to configure the
>> firewall so that zookeeper can work correctly.
>>
>> I'm going to work on the iptables to open connections needed by zookeeper.
>> If any one knows of a way to do this or even just a link to configuring an
>> iptable with zookeeper in mind, I'd appreciate it.
>>
>> Thanks again for the help.
>> Erik
>>
>>
>> On 21 June 2010 20:56, Joe Zou<jo...@hz.webex.com>  wrote:
>>
>>  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.shiken@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:
>>>
>>> *[root@master1 bin]# ./zkServer.sh start
>>> JMX enabled by default
>>> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>>> Starting zookeeper ...
>>> STARTED
>>> [root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
>>> [main:QuorumPeerConfig@80] - Reading configuration from:
>>> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>>> 2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting
>>> to
>>> majority quorums
>>> 2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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

Posted by Patrick Hunt <ph...@apache.org>.
There are 3 ports that need to be opened

1) the client port (btw client and servers)
2/3) the quorum and election ports - only btw servers

You are setting these three ports in your config file (clientport 
defaults to 2181 iirc, unless you override)

Patrick

On 06/22/2010 06:17 AM, Erik Test wrote:
> Thanks for your help. The missing file issue is resolved.
>
> I was confused by how to start zookeeper because a firewall is blocking
> connections between nodes. The odd thing is hadoop can run on its own with
> the configured iptables but doesn't work with zookeeper for some reason. The
> problem here is I can't turn off the firewall and need to configure the
> firewall so that zookeeper can work correctly.
>
> I'm going to work on the iptables to open connections needed by zookeeper.
> If any one knows of a way to do this or even just a link to configuring an
> iptable with zookeeper in mind, I'd appreciate it.
>
> Thanks again for the help.
> Erik
>
>
> On 21 June 2010 20:56, Joe Zou<jo...@hz.webex.com>  wrote:
>
>> 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.shiken@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:
>>
>> *[root@master1 bin]# ./zkServer.sh start
>> JMX enabled by default
>> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>> Starting zookeeper ...
>> STARTED
>> [root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
>> [main:QuorumPeerConfig@80] - Reading configuration from:
>> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
>> 2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting
>> to
>> majority quorums
>> 2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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

Posted by Erik Test <er...@gmail.com>.
Thanks for your help. The missing file issue is resolved.

I was confused by how to start zookeeper because a firewall is blocking
connections between nodes. The odd thing is hadoop can run on its own with
the configured iptables but doesn't work with zookeeper for some reason. The
problem here is I can't turn off the firewall and need to configure the
firewall so that zookeeper can work correctly.

I'm going to work on the iptables to open connections needed by zookeeper.
If any one knows of a way to do this or even just a link to configuring an
iptable with zookeeper in mind, I'd appreciate it.

Thanks again for the help.
Erik


On 21 June 2010 20:56, Joe Zou <jo...@hz.webex.com> wrote:

> 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.shiken@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:
>
> *[root@master1 bin]# ./zkServer.sh start
> JMX enabled by default
> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> Starting zookeeper ...
> STARTED
> [root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
> [main:QuorumPeerConfig@80] - Reading configuration from:
> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> 2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting
> to
> majority quorums
> 2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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
>

答复: Starting zookeeper in replicated mode

Posted by Joe Zou <jo...@hz.webex.com>.
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.shiken@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:

*[root@master1 bin]# ./zkServer.sh start
JMX enabled by default
Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
Starting zookeeper ...
STARTED
[root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
[main:QuorumPeerConfig@80] - Reading configuration from:
/root/zookeeper-3.2.2/bin/../conf/zoo.cfg
2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting to
majority quorums
2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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

Posted by Andrei Savu <sa...@gmail.com>.
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 <er...@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:
>
> *[root@master1 bin]# ./zkServer.sh start
> JMX enabled by default
> Using config: /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> Starting zookeeper ...
> STARTED
> [root@master1 bin]# 2010-06-21 12:25:23,738 - INFO
> [main:QuorumPeerConfig@80] - Reading configuration from:
> /root/zookeeper-3.2.2/bin/../conf/zoo.cfg
> 2010-06-21 12:25:23,743 - INFO  [main:QuorumPeerConfig@232] - Defaulting to
> majority quorums
> 2010-06-21 12:25:23,745 - FATAL [main:QuorumPeerMain@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: Starting zookeeper in replicated mode

Posted by Luka Stojanovic <lu...@vast.com>.
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