zookeeper启动后 查看节点时返回拒绝连接

2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:java.io.tmpdir=/tmp
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:java.compiler=<NA>
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:os.name=Linux
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:os.arch=amd64
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:os.version=3.10.0-862.el7.x86_64
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:user.name=root
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:user.home=/root
2020-12-16 15:19:36,741 [myid:] - INFO  [main:Environment@98] - Client environment:user.dir=/opt/software/apache-zookeeper-3.6.2-bin/bin
2020-12-16 15:19:36,742 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.free=22MB
2020-12-16 15:19:36,746 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.max=228MB
2020-12-16 15:19:36,746 [myid:] - INFO  [main:Environment@98] - Client environment:os.memory.total=29MB
2020-12-16 15:19:36,749 [myid:] - INFO  [main:ZooKeeper@1006] - Initiating client connection, connectString=192.168.179.128:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@4361bd48
2020-12-16 15:19:36,755 [myid:] - INFO  [main:X509Util@77] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2020-12-16 15:19:36,765 [myid:] - INFO  [main:ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes
2020-12-16 15:19:36,776 [myid:] - INFO  [main:ClientCnxn@1716] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
JLine support is enabled
[zk: 192.168.179.128:2181(CONNECTING) 0] ls /
2020-12-16 15:19:47,361 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1167] - Opening socket connection to server 192.168.179.128/192.168.179.128:2181.
2020-12-16 15:19:47,361 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1169] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
2020-12-16 15:19:47,370 [myid:192.168.179.128:2181] - WARN  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1285] - Session 0x0 for sever 192.168.179.128/192.168.179.128:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
java.net.ConnectException: 拒绝连接
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:714)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1275)
KeeperErrorCode = ConnectionLoss for /
[zk: 192.168.179.128:2181(CONNECTING) 1] 2020-12-16 15:20:08,514 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1167] - Opening socket connection to server 192.168.179.128/192.168.179.128:2181.
2020-12-16 15:20:08,514 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1169] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
2020-12-16 15:20:08,515 [myid:192.168.179.128:2181] - WARN  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1285] - Session 0x0 for sever 192.168.179.128/192.168.179.128:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
java.net.ConnectException: 拒绝连接
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:714)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1275)
2020-12-16 15:20:14,872 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1167] - Opening socket connection to server 192.168.179.128/192.168.179.128:2181.
2020-12-16 15:20:14,872 [myid:192.168.179.128:2181] - INFO  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1169] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
2020-12-16 15:20:14,872 [myid:192.168.179.128:2181] - WARN  [main-SendThread(192.168.179.128:2181):ClientCnxn$SendThread@1285] - Session 0x0 for sever 192.168.179.128/192.168.179.128:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
java.net.ConnectException: 拒绝连接
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:714)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1275)

原因:zookeeper需要使用8080端口。
我的原因就是8080端口被占用了

解决方案:
在配置文件中指定一下端口号admin.serverPort=8081

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/opt/software/apache-zookeeper-3.6.2-bin/data
dataLogDir=/opt/software/apache-zookeeper-3.6.2-bin/data/logs
clientPort=2181
admin.serverPort=8081
server.1=192.168.179.128:2888:3888
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐