我正在嘗試使用三個節點以完全分佈式模式部署zookeeper集合。在啓動服務器後,沒有條目出現在jps下。在給 「zkServer.sh狀態」 的輸出爲:ZooKeeper啓動成功但不起作用
JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Error contacting service. It is probably not running
在這些命令: 「zkCli.sh -server zks1:2181」 是:
Connecting to zks1:2181
2015-05-24 23:02:24,602 [myid:] - INFO [main:[email protected]] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2015-05-24 23:02:24,605 [myid:] - INFO [main:[email protected]] - Client environment:host.name=mtech2-OptiPlex-7010
2015-05-24 23:02:24,606 [myid:] - INFO [main:[email protected]] - Client environment:java.version=1.7.0_79
2015-05-24 23:02:24,607 [myid:] - INFO [main:[email protected]] - Client environment:java.vendor=Oracle Corporation
2015-05-24 23:02:24,607 [myid:] - INFO [main:[email protected]] - Client environment:java.home=/usr/lib/jvm/java-7-openjdk-amd64/jre
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:java.class.path=/usr/local/zookeeper/bin/../build/classes:/usr/local/zookeeper/bin/../build/lib/*.jar:/usr/local/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/bin/../zookeeper-3.4.6.jar:/usr/local/zookeeper/bin/../src/java/lib/*.jar:/usr/local/zookeeper/bin/../conf:
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - 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-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:java.io.tmpdir=/tmp
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:java.compiler=<NA>
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:os.name=Linux
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:os.arch=amd64
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:os.version=3.10.75
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:user.name=hduser
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:user.home=/home/hduser
2015-05-24 23:02:24,608 [myid:] - INFO [main:[email protected]] - Client environment:user.dir=/usr/local/zookeeper
2015-05-24 23:02:24,609 [myid:] - INFO [main:[email protected]] - Initiating client connection, connectString=zks1:2181 sessionTimeout=30000 [email protected]
Welcome to ZooKeeper!
2015-05-24 23:02:24,741 [myid:] - INFO [main-SendThread(zks1:2181):[email protected]] - Opening socket connection to server zks1/192.168.4.60:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2015-05-24 23:02:24,755 [myid:] - WARN [main-SendThread(zks1:2181):[email protected]] - 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:739)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
[zk: zks1:2181(CONNECTING) 0]
的/ etc/hosts文件是遵循所有節點:
192.168.4.60 zks1
192.168.4.61 zks2
192.168.4.66 zks3
的zoo.cfg文件如下:
dataDir=/var/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.server1=zks1:2888:3888
server.server2=zks2:2888:3888
server.server3=zks3:2888:3888
我已經在所有節點上創建了目錄/ var/zookeeper,並將所有權更改爲hduser:hadoop。
導出的環境變量是:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export ZK_HOME=/usr/local/zookeeper
export PATH=$PATH:$ZK_HOME/bin
的身份識別碼的數據目錄(/ var /動物園管理員/)分別是服務器1,服務器和服務器3。
請指出問題所在。
你是否試圖在同一臺機器上運行多個服務器? – user2720864
不,我在多臺機器上運行。我找到了解決方案。通過server.1替換server.server1,並相應地修改每個節點的myid文件的技巧。 –