|
|
-
Re: Setting Zookeeper server cluster on single hostAlexander Shraer 2012-03-07, 15:12
you need to have a different set of ports for each server in the config files. Otherwise ports 5181 and 5888 just get taken by the first server...
server.1=127.0.0.1:5181:5887 server.2=127.0.0.1:5182:5888 server.3=127.0.0.1:5183:5889 Alex On Mar 7, 2012, at 6:57 AM, "hrm" <[EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote: I am using Zookeeper 3.4.3 for setting server cluster on single host. I have three separate installations of zookeeper and corresponding dataDir on a host. Following configuration is present on each server: # 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=/var/lib/zookeeper # the port at which the clients will connect clientPort=2181 # cluster servers server.1=127.0.0.1:5181:5888 server.2=127.0.0.1:5181:5888 server.3=127.0.0.1:5181:5888 I cannot start the server 2 and 3 because the client port is already taken. I get following error. 012-03-07 10:56:34,481 [myid:] - INFO [main:QuorumPeerConfig@101][] - Reading configuration from: /usr/local/zookeeper_3/bin/../conf/zoo.cfg 2012-03-07 10:56:34,540 [myid:] - INFO [main:QuorumPeerConfig@334][] - Defaulting to majority quorums 2012-03-07 10:56:34,589 [myid:3] - INFO [main:DatadirCleanupManager@78][] - autopurge.snapRetainCount set to 3 2012-03-07 10:56:34,590 [myid:3] - INFO [main:DatadirCleanupManager@79][] - autopurge.purgeInterval set to 0 2012-03-07 10:56:34,591 [myid:3] - INFO [main:DatadirCleanupManager@101][] - Purge task is not scheduled. 2012-03-07 10:56:34,616 [myid:3] - INFO [main:QuorumPeerMain@127][] - Starting quorum peer 2012-03-07 10:56:34,901 [myid:3] - INFO [main:NIOServerCnxnFactory@110][] - binding to port 0.0.0.0/0.0.0.0:2181 2012-03-07 10:56:34,902 [myid:3] - ERROR [main:QuorumPeerMain@89][] - Unexpected exception, exiting abnormally java.net.BindException: Address already in use at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:70) at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:111) at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:130) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) After giving each server a different client port, I could start all servers. However, I could see following error in one of the server logs. 2012-03-07 13:21:33,399 [myid:2] - INFO [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2182:Leader@296][] - LEADING - LEADER ELECTION TOOK - 431 2012-03-07 13:21:33,403 [myid:2] - INFO [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2182:FileSnap@83][] - Reading snapshot /var/lib/zookeeper_2/version-2/snapshot.400000000 2012-03-07 13:21:33,408 [myid:2] - INFO [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2182:FileTxnSnapLog@238][] - Snapshotting: 0x400000000 to /var/lib/zookeeper_2/version-2/snapshot.400000000 2012-03-07 13:21:33,960 [myid:2] - INFO [/127.0.0.1:5888:QuorumCnxManager$Listener@486][] - My election bind port: 0.0.0.0/0.0.0.0:5888 2012-03-07 13:21:33,961 [myid:2] - ERROR [/127.0.0.1:5888:QuorumCnxManager$Listener@499][] - Exception while listening java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353) at java.net.ServerSocket.bind(ServerSocket.java:336) at java.net.ServerSocket.bind(ServerSocket.java:294) at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:489) 2012-03-07 13:21:34,208 [myid:2] - INFO [LearnerHandler-/127.0.0.1:33958:LearnerHandler@264][] - Follower sid: 1 : info : org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer@1ad98ef 2012-03-07 13:21:34,353 [myid:2] - INFO [LearnerHandler-/127.0.0.1:33958:LearnerHandler@319][] - Synchronizing with Follower sid: 1 maxCommittedLog=0x0 minCommittedLog=0x0 peerLastZxid=0x300000000 2012-03-07 13:21:34,354 [myid:2] - INFO [LearnerHandler-/127.0.0.1:33958:LearnerHandler@418][] - Sending snapshot last zxid of peer is 0x300000000 zxid of leader is 0x500000000sent zxid of db as 0x400000000 2012-03-07 13:21:34,420 [myid:2] - WARN [LearnerHandler-/127.0.0.1:33958:Leader@505][] - Commiting zxid 0x500000000 from /127.0.0.1:5181 not first! 2012-03-07 13:21:34,421 [myid:2] - WARN [LearnerHandler-/127.0.0.1:33958:Leader@507][] - First is 0x0 2012-03-07 13:21:34,421 [myid:2] - INFO [LearnerHandler-/127.0.0.1:33958:Leader@529][] - Have quorum of supporters; starting up and setting last processed zxid: 0x500000000 2012-03-07 13:21:34,961 [myid:2] - INFO [/127.0.0.1:5888:QuorumCnxManager$Listener@486][] - My election bind port: 0.0.0.0/0.0.0.0:5888 2012-03-07 13:21:34,961 [myid:2] - ERROR [/127.0.0.1:5888:QuorumCnxManager$Listener@499][] - Exception while listening java.net.BindException: Address already in use at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:353) at java.net.ServerSocket.bind(ServerSocket.java:336) at java.net.ServerSocket.bind(ServerSocket.java:294) at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:489) 2012-03-07 13:21:35,962 [myid:2] - INFO [/127.0.0.1:5888:QuorumCnxManager$Listener@512][] - Leaving listener 2012-03-07 13:21:35,963 [myid:2] - ERROR [/127.0.0.1:5888:QuorumCnxManager$Listener@514][] - As I'm leavi |