zoo.cfg配置
三台都配置了myid,互相能ping通,三台zookeeper服务都启动后,启动客户端报错如下:
Connecting to localhost:2181
2018-08-05 09:41:11,036 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.11-37e277162d567b55a07d1755f0b31c32e93c01a0, built on 11/01/2017 18:06 GMT
2018-08-05 09:41:11,044 [myid:] - INFO [main:Environment@100] - Client environment:host.name=localhost
2018-08-05 09:41:11,044 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_181
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/jdk8/jre
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - 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.10.5.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/../lib/audience-annotations-0.5.0.jar:/usr/local/zookeeper/bin/../zookeeper-3.4.11.jar:/usr/local/zookeeper/bin/../src/java/lib/*.jar:/usr/local/zookeeper/bin/../conf:.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-08-05 09:41:11,046 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.10.0-229.el7.x86_64
2018-08-05 09:41:11,047 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root
2018-08-05 09:41:11,047 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root
2018-08-05 09:41:11,047 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/usr/local/zookeeper/bin
2018-08-05 09:41:11,048 [myid:] - INFO [main:ZooKeeper@441] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@67424e82
2018-08-05 09:41:11,072 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1035] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
JLine support is enabled
2018-08-05 09:41:11,172 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@877] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-08-05 09:41:11,185 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - 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] 2018-08-05 09:41:11,757 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1035] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-08-05 09:41:11,759 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@877] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2018-08-05 09:41:11,763 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
2018-08-05 09:41:12,964 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1035] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-08-05 09:41:12,965 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@877] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-08-05 09:41:12,969 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1161] - Unable to read additional data from server sessionid 0x0, likely server has closed socket, closing socket connection and attempting reconnect
端口监控如图:
一直失败,跪求指点