zookeeper集群安装启动失败

[root@XX4 ~]# cd /data/software/zookeeper-3.4.8/
[root@XX4 zookeeper-3.4.8]# bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /data/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@XX4 zookeeper-3.4.8]#
[root@XX4 zookeeper-3.4.8]#
[root@XX4 zookeeper-3.4.8]# bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /data/software/zookeeper-3.4.8/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.



2016-04-28 22:55:04,574 [myid:1] - INFO [CommitProcessor:1:ZooKeeperServer@645] - Established session 0x1545d5d06980000 with negotiated timeout 30000 for client /127.0.0.1:33953
2016-04-28 22:55:30,005 [myid:1] - INFO [CommitProcessor:1:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:33948 which had sessionid 0x1544d60a0180000
2016-04-28 22:58:46,693 [myid:1] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@357] - caught end of stream exception
EndOfStreamException: Unable to read additional data from client sessionid 0x1545d5d06980000, likely client has closed socket
at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:230)
at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:203)
at java.lang.Thread.run(Thread.java:745)
2016-04-28 22:58:46,694 [myid:1] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008] - Closed socket connection for client /127.0.0.1:33953 which had sessionid 0x1545d5d06980000
2016-05-03 10:26:37,764 [myid:1] - INFO [XX2/10.252.17.3:3888:QuorumCnxManager$Listener@541] - Received connection request /10.252.17.223:47680
2016-05-03 10:26:37,774 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection@600] - Notification: 1 (message format version), 3 (n.leader), 0x100000001 (n.zxid), 0x1 (n.round), LOOKING (n.state), 3 (n.sid), 0x2 (n.peerEpoch) FOLLOWING (my state)
2016-05-03 10:26:37,784 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection@600] - Notification: 1 (message format version), 3 (n.leader), 0x100000001 (n.zxid), 0x3 (n.round), LOOKING (n.state), 3 (n.sid), 0x2 (n.peerEpoch) FOLLOWING (my state)

wangxiaolei

赞同来自:

在 zookeeper-3.4.8目录下,应该有zookeeper.out文件,看看有什么错误提示。

wangxiaolei

赞同来自:

私信发下Ip,密码

wangxiaolei

赞同来自:

已经启动成功了
1462330585504.png
 

wangxiaolei

赞同来自:

这个Error暂时不用管, zookeeper停止后,再启动。 然后去查看状态会有提示:Error contacting service.It is probably not running 客户端可以连接上
[root@XX4 zookeeper-3.4.8]#  bin/zkCli.sh -server XX2:2181
Connecting to XX2:2181
2016-05-04 12:32:31,056 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2016-05-04 12:32:31,066 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=XX4
2016-05-04 12:32:31,066 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.7.0_99
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.99.x86_64/jre
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/data/software/zookeeper-3.4.8/bin/../build/classes:/data/software/zookeeper-3.4.8/bin/../build/lib/*.jar:/data/software/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/data/software/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/data/software/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/data/software/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/data/software/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/data/software/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/data/software/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/data/software/zookeeper-3.4.8/bin/../conf:
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2016-05-04 12:32:31,069 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2016-05-04 12:32:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2016-05-04 12:32:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.23.3.el6.x86_64
2016-05-04 12:32:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2016-05-04 12:32:31,070 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2016-05-04 12:32:31,071 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/data/software/zookeeper-3.4.8
2016-05-04 12:32:31,072 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=XX2:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@152e0066
Welcome to ZooKeeper!
2016-05-04 12:32:31,111 [myid:] - INFO  [main-SendThread(XX2:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server XX2/10.252.17.3:2181. Will not attempt to authenticate using SASL (unknown error)
2016-05-04 12:32:31,171 [myid:] - INFO  [main-SendThread(XX2:2181):ClientCnxn$SendThread@876] - Socket connection established to XX2/10.252.17.3:2181, initiating session
JLine support is enabled
2016-05-04 12:32:31,251 [myid:] - INFO  [main-SendThread(XX2:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server XX2/10.252.17.3:2181, sessionid = 0x15479eaf6000000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: XX2:2181(CONNECTED) 0] ls /
[zookeeper]
[zk: XX2:2181(CONNECTED) 1] 

hahastar

赞同来自:

感觉应该是你的zoo.cfg没有配好,看看你的zoo.cfg文件里面每个server的主机名有没有写错?我之前也是能启动但是也报了这样的错,是主机名没有配好的原因。

fish - Hadooper

赞同来自:

错误原因是,你的conf/zoo.cfg中配置了两个clientPort=2181。   排查问题的方法很简单,你执行命令所抛的错误,在bin/zkServer.sh这个脚本中,其中的一段:
status)
    # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
    clientPortAddress=`$GREP "^[[:space:]]*clientPortAddress[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
    if ! [ $clientPortAddress ]
    then
        clientPortAddress="localhost"
    fi
    clientPort=`$GREP "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
    STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
             -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \
             $clientPortAddress $clientPort srvr 2> /dev/null    \
          | $GREP Mode`
    if [ "x$STAT" = "x" ]
    then
        echo "Error contacting service. It is probably not running."
        exit 1
    else
        echo $STAT
        exit 0
    fi
这里的STAT的计算,使用了clientPort,而clientPort=`$GREP "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`,这实际是执行的grep ^[[:space:]]*clientPort[^[:alpha:]] /data/software/zookeeper-3.4.8/bin/../conf/zoo.cfg | sed -e 's/.*=//'。    你直接在自己的linux shell里面敲一下grep ^[[:space:]]*clientPort[^[:alpha:]] /data/software/zookeeper-3.4.8/bin/../conf/zoo.cfg这个命令,就会发现,clientPort被定义了两遍。

要回复问题请先登录注册