문제

I am new to Zookeeper and was setting up Solr Cloud using Zookeeper Ensemble in my system, The problem comes when I try to run all the Zookeepers together, There are three Zookeeper running on three separate ports and point them to my Solr which is installed on Apache Tomcat Server. The Configuration files are as follows :-

zoo1.cfg

tickTime=2000
dataDir=/Users/prime/Desktop/Deployment Docs/Zookeeper/data
clientPort=2181
initLimit=5
syncLimit=2
server.1=localhost:8002:3888
server.2=localhost:8005:3889
server.3=localhost:8008:3890

zoo2.cfg

tickTime=2000
dataDir=/Users/prime/Desktop/Deployment Docs/Zookeeper/data
clientPort=2182
initLimit=5
syncLimit=2
server.1=localhost:8002:3888
server.2=localhost:8005:3889
server.3=localhost:8008:3890

zoo3.cfg

tickTime=2000
dataDir=/Users/prime/Desktop/Deployment Docs/Zookeeper/data
clientPort=2183
initLimit=5
syncLimit=2
server.1=localhost:8002:3888
server.2=localhost:8005:3889
server.3=localhost:8008:3890

After this when I try to connect the server at 2181. Using ./zkCli it gives me the following error :-

sh-3.2#./zkCli.sh 
Connecting to localhost:2181
2014-01-24 20:09:49,594 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
2014-01-24 20:09:49,599 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=172.16.217.13
2014-01-24 20:09:49,600 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_17
2014-01-24 20:09:49,600 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2014-01-24 20:09:49,601 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre
2014-01-24 20:09:49,601 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/opt/zookeeper-3.4.5/bin/../build/classes:/opt/zookeeper-3.4.5/bin/../build/lib/*.jar:/opt/zookeeper-3.4.5/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper-3.4.5/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper-3.4.5/bin/../lib/netty-3.2.2.Final.jar:/opt/zookeeper-3.4.5/bin/../lib/log4j-1.2.15.jar:/opt/zookeeper-3.4.5/bin/../lib/jline-0.9.94.jar:/opt/zookeeper-3.4.5/bin/../zookeeper-3.4.5.jar:/opt/zookeeper-3.4.5/bin/../src/java/lib/*.jar:/opt/zookeeper-3.4.5/bin/../conf:
2014-01-24 20:09:49,602 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/Users/prime/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2014-01-24 20:09:49,602 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/var/folders/vn/7793lhcn73db6jyy3fzvwv240000gn/T/
2014-01-24 20:09:49,602 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2014-01-24 20:09:49,603 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Mac OS X
2014-01-24 20:09:49,603 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=x86_64
2014-01-24 20:09:49,604 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=10.8.5
2014-01-24 20:09:49,604 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=prime
2014-01-24 20:09:49,605 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/Users/prime
2014-01-24 20:09:49,605 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/opt/zookeeper-3.4.5/bin
2014-01-24 20:09:49,607 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@7d25e791
Welcome to ZooKeeper!
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0] 2014-01-24 20:09:54,634 [myid:] - INFO  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181):ClientCnxn$SendThread@966] - Opening socket connection to server fe80:0:0:0:0:0:0:1%1/fe80:0:0:0:0:0:0:1%1:2181. Will not attempt to authenticate using SASL (unknown error)
2014-01-24 20:09:54,642 [myid:] - WARN  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181):ClientCnxn$SendThread@1089] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
2014-01-24 20:09:54,748 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@966] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2014-01-24 20:09:54,749 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1089] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
2014-01-24 20:09:54,852 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@966] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2014-01-24 20:09:54,854 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1089] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)

My question is what is going wrong and how to get rid of this. Since I am not able to rectify it anyways.

도움이 되었습니까?

해결책

First of all you should have separate data directory for each zookeeper instance. Inside the data directory create a file called myid. In those file only write 1, 2 or 3 depending upon the server (e.g For server1 write 1). Please check here

Then start your zookeeper ensemble.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top