作者:手机用户2502862581 | 来源:互联网 | 2023-05-17 21:58
我正在尝试在ec2的两个实例上设置zookeeper。如这里和这里所给。我正在尝试运行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=:2889:3889
我也在两个ec2实例上都创建了myId文件- /var/lib/zookeeper/myid
我也尝试编辑/ ect / hosts文件,但仍然面临相同的问题。还如何通过1命令启动两个zookeeper实例?
注意:如果我尝试使用bin/zkCli.sh start
命令,服务器将成功启动。
提前致谢!