Zookeeper Ensemble不响应客户端?

时间:2014-01-24 14:55:49

标签: java tomcat solr apache-zookeeper solr4

我是Zookeeper的新手,并且正在我的系统中使用Zookeeper Ensemble设置Solr Cloud,当我尝试将所有Zookeepers一起运行时出现问题,有三个Zookeeper在三个独立的端口上运行并将它们指向我的Solr安装在Apache Tomcat服务器上。配置文件如下: -

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

此后当我尝试在2181连接服务器时。使用./zkCli它会出现以下错误: -

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)

我的问题是出了什么问题以及如何摆脱这个问题。因为我无论如何都无法纠正它。

1 个答案:

答案 0 :(得分:1)

首先,您应该为每个zookeeper实例分别设置数据目录。在数据目录中创建一个名为 myid 的文件。在那些文件中,只根据服务器写入1,2或3(例如,对于server1写入1)。请check here

然后启动你的zookeeper合奏。