Zookeeper的错误(启动成功,客服端报错)

# 接下来启动 zkServer.sh

# 接下来启动 zkServer.sh

[scidb@localhost bin]$ zkServer.sh start

ZooKeeper JMX enabled by default

Using config: /home/scidb/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg

Starting zookeeper ... STARTED

# 看起来是启动成功了哦,然后我们再来看看是否真的启动成功了。

# 看起来是启动成功了哦,然后我们再来看看是否真的启动成功了。

[scidb@localhost bin]$ zkServer.sh status

ZooKeeper JMX enabled by default

Using config: /home/scidb/zookeeper/zookeeper-3.4.8/bin/../conf/zoo.cfg

Error contacting service. It is probably not running.

# 呵呵,居然没有启动起来。然后我用zkCli.sh 尝试启动客户端,结果。。

# 呵呵,居然没有启动起来。然后我用zkCli.sh 尝试启动客户端,结果。。

[scidb@localhost bin]$ sh zkCli.sh 

Connecting to localhost:2181

2016-02-29 15:50:04,735 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT

2016-02-29 15:50:04,739 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=localhost

2016-02-29 15:50:04,739 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_25

2016-02-29 15:50:04,740 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/java/jdk1.8.0_25/jre

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/home/scidb/zookeeper/zookeeper-3.4.8/bin/../build/classes:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../build/lib/*.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/home/scidb/zookeeper/zookeeper-3.4.8/bin/../conf:.:/usr/java/jdk1.8.0_25/lib/jt.jar:/usr/java/jdk1.8.0_25/lib/tools.jar:%JRE_HOME/lib:/home/123/Desktop/123/scidb4j.jar:/home/123/Desktop/123/protobuf-java.jar

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=:/opt/scidb/14.12/lib:/opt/scidb/14.12/lib:/opt/scidb/14.12/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.29.2.el6.x86_64

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=scidb

2016-02-29 15:50:04,741 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/home/scidb

2016-02-29 15:50:04,742 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/home/scidb/zookeeper/zookeeper-3.4.8/bin

2016-02-29 15:50:04,743 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@277050dc

Welcome to ZooKeeper!

2016-02-29 15:50:04,768 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)

JLine support is enabled

[zk: localhost:2181(CONNECTING) 0] 2016-02-29 15:50:04,828 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1162] - 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:716)

at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

2016-02-29 15:50:04,935 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)

2016-02-29 15:50:04,937 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1162] - 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:716)

at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

2016-02-29 15:50:05,039 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/192.168.133.130:2181. Will not attempt to authenticate using SASL (unknown error)

2016-02-29 15:50:05,040 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1162] - 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:716)

at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
# 坑爹啊, 第一天的时候明明好好的,怎么现在就成这样的了。。。

# 我检查了配置文件,conf/zoo.cfg

[scidb@localhost bin]$ cat ../conf/zoo.cfg 

tickTime=2000

initLimit=5

syncLimit=2

dataDir=/var/lib/zookeeper/

clientPort=2181

server.1=localhost:2888:3888

 
# 好好的,没什么问题啊。于是我又检查了 /var/lib/zookeeper/myid

[scidb@localhost bin]$ cat /var/lib/zookeeper/myid 

1

 

# 乍一看配置没错啊,我想看看到底2181端口是否被占用。

[scidb@localhost bin]$ sudo netstat -anp | grep 2181

 

# 呵呵居然什么都没有,我启动了tomcat,然后用命令在看看

[scidb@localhost bin]$ sudo netstat -anp | grep 8080

tcp        0      0 :::8080                     :::*                        LISTEN      5027/java 

 

# 命令没有问题,程序是真的没有启动起来。

# 接下来我在google和百度里看了搜索了许多有关于这个错误的信息。

分别搜索了‘at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)’、

‘at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

’、‘INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)’……

看了很多在http://stackoverflow.com/ 上的回答。。。

我靠,居然都没有用啊,多数都在强调你的配置文件的问题。但是配置都已经看烂了,没有什么问题啊!!!

然而发现是Will not attempt to authenticate using SASL错误

最后解决的办法是

将data和logs目录下的文件里的内容全部删除,如果需要权限,则赋予权限

你可能感兴趣的:(zookeeper)