请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

三台虚拟机集群失败

zoo.cfg配置

https://img1.sycdn.imooc.com//szimg/5b6655180001c28f06220395.jpg

三台都配置了myid,互相能ping通,三台zookeeper服务都启动后,启动客户端报错如下:

https://img1.sycdn.imooc.com//szimg/5b6655860001511e18200661.jpg

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

端口监控如图:

https://img1.sycdn.imooc.com//szimg/5b665687000146ab08100220.jpg

一直失败,跪求指点


正在回答

4回答

风间影月 2018-08-05 10:30:05

对了,你这个是启动一台报的错吗??如果是,那就启动三台,集群状态下,启动一台,再用zkCli.sh 的话zk会报错,你必须三台全部启动才能连接客户端

0 回复 有任何疑惑可以回复我~
  • 提问者 callme激流 #1
    三个zoo.cfg,集群配置都配置了,也三台都启动了。可奇怪了就是不行
    回复 有任何疑惑可以回复我~ 2018-08-05 10:39:01
  • 风间影月 回复 提问者 callme激流 #2
    三台启动就可以用zkCli连接了,不行的话建议你再跟着视频走一下吧~~
    回复 有任何疑惑可以回复我~ 2018-08-05 10:44:39
  • 提问者 callme激流 回复 风间影月 #3
    好的,谢谢老师
    回复 有任何疑惑可以回复我~ 2018-08-05 10:46:56
风间影月 2018-08-05 10:27:28

集群配置 server.1 2 3分别在三台机子配置了吗?

0 回复 有任何疑惑可以回复我~
风间影月 2018-08-05 10:00:17

另外三台虚拟机要注意,使用桥接,不要使用宿主

0 回复 有任何疑惑可以回复我~
  • 提问者 callme激流 #1
    老师,我记得创建虚拟机时候用的是桥接,配置静态ip时候
    修改了/etc/sysconfig/network-scripts下的文件
    BOOTPROTO="static"
    BROADCAST=192.168.1.255
    IPADDR=192.168.1.111
    NETMASK=255.255.255.0
    GATEWAY=192.168.1.1
    DNS1=8.8.8.8
    回复 有任何疑惑可以回复我~ 2018-08-05 10:29:34
  • 风间影月 回复 提问者 callme激流 #2
    每台机子的IP都是独立的,都是同网段的
    回复 有任何疑惑可以回复我~ 2018-08-05 10:33:24
  • 提问者 callme激流 回复 风间影月 #3
    我配置的111,112,113
    回复 有任何疑惑可以回复我~ 2018-08-05 10:43:02
风间影月 2018-08-05 09:56:16

第二张图看不清,手机上看太模糊,可以再截了发一下吗?

0 回复 有任何疑惑可以回复我~
  • 提问者 callme激流 #1
    2018-08-05 10:15:49,636 [myid:] - INFO  [main-SendThread(192.168.1.111: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 10:18:26
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信