很无语的Zookeeper zkCli连接zkServer失败问题

Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

Connecting to localhost:2181
2017-10-24 07:15:21,534 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2017-10-24 07:15:21,537 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=server1
2017-10-24 07:15:21,538 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_75
2017-10-24 07:15:21,541 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2017-10-24 07:15:21,541 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/training/jdk1.7.0_75/jre
2017-10-24 07:15:21,541 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/training/zookeeper-3.4.6/bin/../build/classes:/training/zookeeper-3.4.6/bin/../build/lib/*.jar:/training/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/training/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/training/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/training/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/training/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/training/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/training/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/training/zookeeper-3.4.6/bin/../conf:.:/training/java-se-7u75-ri/lib/dt.jar:/training/java-se-7u75-ri/li/tools.jar:/training/java-se-7u75-ri/lib/rt.jar
2017-10-24 07:15:21,541 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/i386:/lib:/usr/lib
2017-10-24 07:15:21,541 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2017-10-24 07:15:21,546 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2017-10-24 07:15:21,546 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2017-10-24 07:15:21,546 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=i386
2017-10-24 07:15:21,546 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-642.el6.x86_64
2017-10-24 07:15:21,546 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2017-10-24 07:15:21,547 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2017-10-24 07:15:21,547 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/training/zookeeper-3.4.6/bin
2017-10-24 07:15:21,550 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@c1f8ca
Welcome to ZooKeeper!
2017-10-24 07:15:21,619 [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
2017-10-24 07:15:21,637 [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)


造成以上问题可能有如下原因:

1、dataDir=/training/zookeeper-3.4.6/data 下的myid文件中写入 server.1=server1:2888:3888  中的1

2、关闭防火墙

3、如果以zkCli.sh 方式启动  Opening socket connection to server localhost/127.0.0.1:2181:正常启动不是localhost/127.0.0.1:2181,而是:localhost/0:0:0:0:0:0:0:1:2181。如果以zkCli.sh 方式启动失败,可以试一下 zkCli.sh -server 127.0.0.1:2181

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值