我正在尝试建立一个由三台服务器组成的zookeeper集群,但我不太清楚我在做什么。我在每台机器上都有相同的配置文件。它看起来像这样:
tickTime=2000
dataDir=/home/scix3/zookeeper/data
clientPort=2181
initLimit=5
syncLimit=2
autopurge.purgeInterval=24
autopurge.snapRetainCount=5
server.1=192.168.2.106:2888:3888
server.2=192.168.2.102:2888:3888
server.3=192.168.2.105:2888:3888
我在dataDir中有一个myid文件,它与zoo.cfg文件中的服务器编号相对应。我知道zookeeper正在每个系统上运行,因为当我命令$ bin / zkServer.sh时输出以下内容:
Starting zookeeper ... already running as process 9548.
但是,当我在任何一台计算机上运行bin / zkCli.sh时,我收到以下消息。
scix3@M6:~/zookeeper$ bin/zkCli.sh
Connecting to localhost:2181
2015-06-02 14:29:57,310 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2015-06-02 14:29:57,313 [myid:] - INFO [main:Environment@100] - Client environment:host.name=M6
2015-06-02 14:29:57,313 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.7.0_79
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-7-openjdk-amd64/jre
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/scix3/zookeeper/bin/../build/classes:/home/scix3/zookeeper/bin/../build/lib/*.jar:/home/scix3/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/scix3/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/home/scix3/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/home/scix3/zookeeper/bin/../lib/log4j-1.2.16.jar:/home/scix3/zookeeper/bin/../lib/jline-0.9.94.jar:/home/scix3/zookeeper/bin/../zookeeper- 3.4.6.jar:/home/scix3/zookeeper/bin/../src/java/lib/*.jar:/home/scix3/zookeeper/bi n/../conf:
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2015-06-02 14:29:57,316 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.13.0-45-generic
2015-06-02 14:29:57,317 [myid:] - INFO [main:Environment@100] - Client environment:user.name=scix3
2015-06-02 14:29:57,317 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/home/scix3
2015-06-02 14:29:57,317 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/scix3/zookeeper
2015-06-02 14:29:57,318 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@2e559e7f
Welcome to ZooKeeper!
2015-06-02 14:29:57,344 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2015-06-02 14:29:57,352 [myid:] - INFO [main- SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2015-06-02 14:29:57,356 [myid:] - INFO [main- SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
[zk: localhost:2181(CONNECTING) 0] 2015-06-02 14:29:59,140 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2015-06-02 14:29:59,140 [myid:] - INFO [main- SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2015-06-02 14:29:59,141 [myid:] - INFO [main- SendThread(localhost:2181):ClientCnxn$SendThread@1098] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
真的,我只是在努力破译正在输出的消息,弄清楚如何让一台机器成为主机,连接整个系统,并用apache风暴实现它。
感谢您的帮助!