I think your issue is that the clientPort is the same port as the
leader communication port in the server.X entry.  So the server begins
listening for clients on port 2181, but then cannot communicate with
the leader, or vice versa.  Change the client port to something other
than 5181 and see if that works.

~Jared

On Wed, Oct 27, 2010 at 9:21 AM, siddhartha banik
<siddhartha.ba...@gmail.com> wrote:
> Hi,
>
> I am trying to configure zookeeper cluster ... with 2 server instances.
> zookeeper version : 3.2.2
>
> Config files are :
>
> *Server 1. zoo.cfg*
>
> tickTime=2000
> initLimit=10
> syncLimit=5
> dataDir=/home/xuser/zookeeper1/zookeeper-3.2.2/data/
> clientPort=5181
> server.1=3.7.192.142:5181:5888
> server.2=3.7.192.145:5181:5888
>
> *Server 2. zoo.cfg*
>
> tickTime=2000
> initLimit=10
> syncLimit=5
> dataDir=/home/xuser/zookeeper2/zookeeper-3.2.2/data/
> clientPort=5181
> server.1=3.7.192.142:5181:5888
> server.2=3.7.192.145:5181:5888
>
> I have also created "*myid*" files in respective data folders. Below are the
> exception I am seeing :
>
> *Server 1*
>
> 2010-10-27 07:43:43,411 - INFO  [QuorumPeer:/0.0.0.0:5181:quorump...@514] -
> LOOKING
> 2010-10-27 07:43:43,418 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@579] - New election: -1
> 2010-10-27 07:43:43,419 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@618] - Notification: 1, -1, 382, 1, LOOKING, LOOKING, 1
> 2010-10-27 07:43:43,420 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@642] - Adding vote
> 2010-10-27 07:43:43,436 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@618] - Notification: 2, 0, 383, 1, LOOKING, LOOKING, 2
> 2010-10-27 07:43:43,442 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@642] - Adding vote
> 2010-10-27 07:43:43,443 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@618] - Notification: 2, 0, 383, 1, LOOKING, LOOKING, 1
> 2010-10-27 07:43:43,443 - INFO  [QuorumPeer:/0.0.0.0:5181
> :fastleaderelect...@642] - Adding vote
> 2010-10-27 07:43:43,444 - INFO  [QuorumPeer:/0.0.0.0:5181:quorump...@523] -
> FOLLOWING
> 2010-10-27 07:43:43,445 - INFO  [QuorumPeer:/0.0.0.0:5181
> :zookeeperser...@160] - Created server
> 2010-10-27 07:43:43,447 - INFO  [QuorumPeer:/0.0.0.0:5181:follo...@147] -
> Following /3.7.192.145:5181
> 2010-10-27 07:43:43,461 - INFO  [WorkerReceiver
> Thread:fastleaderelection$messenger$workerrecei...@254] - Sending new
> notification.
> 2010-10-27 07:43:43,462 - WARN  [QuorumPeer:/0.0.0.0:5181:follo...@318] -
> Exception when following the leader
> java.io.EOFException
>        at java.io.DataInputStream.readInt(DataInputStream.java:375)
>        at
> org.apache.jute.BinaryInputArchive.readInt(BinaryInputArchive.java:63)
>        at
> org.apache.zookeeper.server.quorum.QuorumPacket.deserialize(QuorumPacket.java:66)
>        at
> org.apache.jute.BinaryInputArchive.readRecord(BinaryInputArchive.java:108)
>        at
> org.apache.zookeeper.server.quorum.Follower.readPacket(Follower.java:114)
>        at
> org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:193)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:525)
> 2010-10-27 07:43:43,464 - INFO  [QuorumPeer:/0.0.0.0:5181:follo...@436] -
> shutdown called
> java.lang.Exception: shutdown Follower
>        at
> org.apache.zookeeper.server.quorum.Follower.shutdown(Follower.java:436)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:529)
>
> *Server 2
>
> *010-10-27 07:59:22,387 - INFO  [QuorumPeer:/0.0.0.0:5181:quorump...@535] -
> LEADING
> 2010-10-27 07:59:22,388 - INFO  [QuorumPeer:/0.0.0.0:5181
> :zookeeperser...@160] - Created server
> 2010-10-27 07:59:22,390 - ERROR [QuorumPeer:/0.0.0.0:5181:lea...@127] -
> Couldn't bind to port 5181
> java.net.BindException: Address already in use
>        at java.net.PlainSocketImpl.socketBind(Native Method)
>        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
>        at java.net.ServerSocket.bind(ServerSocket.java:319)
>        at java.net.ServerSocket.<init>(ServerSocket.java:185)
>        at java.net.ServerSocket.<init>(ServerSocket.java:97)
>        at org.apache.zookeeper.server.quorum.Leader.<init>(Leader.java:125)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.makeLeader(QuorumPeer.java:417)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:537)
> 2010-10-27 07:59:22,392 - WARN  [QuorumPeer:/0.0.0.0:5181:quorump...@541] -
> Unexpected exception
> java.net.BindException: Address already in use
>        at java.net.PlainSocketImpl.socketBind(Native Method)
>        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
>        at java.net.ServerSocket.bind(ServerSocket.java:319)
>        at java.net.ServerSocket.<init>(ServerSocket.java:185)
>        at java.net.ServerSocket.<init>(ServerSocket.java:97)
>        at org.apache.zookeeper.server.quorum.Leader.<init>(Leader.java:125)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.makeLeader(QuorumPeer.java:417)
>        at
> org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:537)
> 2010-10-27 07:59:22,393 - INFO  [WorkerReceiver
> Thread:fastleaderelection$messenger$workerrecei...@254] - Sending new
> notification.
> 2010-10-27 07:59:22,394 - INFO  [QuorumPeer:/0.0.0.0:5181:quorump...@514] -
> LOOKING*
> *
>
> I have tried with netstat command also. No other process is using *5181 *port
> other then zookeeper process.
>
> Other thing I have tried is: using separate ports for server1 & server 2.
> Surprise is after starting server 2, server 1 also starts to use the same
> port as server 2 is using as client port. Does that matter , as server1 &
> server 2 are running in different boxes.
>
> Any help is appreciated.
>
>
> Thanks
> Siddhartha
>

Reply via email to