我尝试在ec2上设置zookeeper两个示例。如给定的here和here。我尝试运行zookeeper,但失败并出现错误:命令:bin/zkCli.sh -server localhost:2181
> 2015-03-15 00:22:35,644 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@3ff0efca
Welcome to ZooKeeper!
2015-03-15 00:22:35,671 [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-03-15 00:22:35,677 [myid:] - WARN [main-SendThread(localhost:2181):ClientCnxn$SendThread@1102] - 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: localhost:2181(CONNECTING) 0] 2015-03-15 00:22:36,796 [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-03-15 00:22:36,797 [myid:] - WARN [main-SendThread(localhost:2181):ClientCnxn$SendThread@1102] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
zoo.cfg如下
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/lib/zookeeper
clientPort=2181
server.1=localhost:2888:3888
server.2=<My ec2 private IPs>:2889:3889
我还在两个ec2示例上创建了myId文件-/var/lib/zookeeper/myid
我也尝试过编辑/ect/hosts文件,但仍然面临同样的问题。还有我如何通过一个命令启动两个zookeeper示例?
注意:如果我尝试使用bin/zkCli.sh start
命令,服务器将成功启动。
提前感谢!
4条答案
按热度按时间44u64gxh1#
查看zk日志zookeeper.out,如果有连接限制错误,请配置以下内容到zoo.cfg。
slsn1g292#
这是暂时的错误,对于我一段时间后,它消失了:-
这是我的zoo.conf文件::-
p8ekf7hl3#
当我忘记
run% ZOOKEEPER_HOME% \ bin \ zkserver.cmd
时发生此错误通过运行,该问题已得到解决。
kjthegm64#
请在www.example.com上更正此属性server.properties
默认为localhost,请更改它以匹配zookeeper服务器启动ip和端口
Zookeeper0.0.0.0:2181