zookeeper最常见的错误:防火墙没关

今天敲商城的时候,启动tomcat然后就报了这个错误,最后发现是因为Linux的防火墙没有关闭导致的

2017-11-13 09:26:45,448 [localhost-startStop-1] [org.apache.zookeeper.ClientCnxn]-[DEBUG] zookeeper.disableAutoWatchReset is false
2017-11-13 09:26:45,542 [localhost-startStop-1] [org.I0Itec.zkclient.ZkClient]-[DEBUG] Awaiting connection to Zookeeper server
2017-11-13 09:26:45,542 [localhost-startStop-1] [org.I0Itec.zkclient.ZkClient]-[DEBUG] Waiting for keeper state SyncConnected
2017-11-13 09:26:45,568 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[INFO] Opening socket connection to server 192.168.25.128/192.168.25.128:2181. Will not attempt to authenticate using SASL (unknown error)
2017-11-13 09:27:06,571 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection timed out: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
2017-11-13 09:27:06,668 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown input
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780)
    at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170)
2017-11-13 09:27:06,668 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown output
java.nio.channels.ClosedChannelException
    at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797)
    at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407)
    at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207)
    at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170)
2017-11-13 09:27:07,775 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[INFO] Opening socket connection to server 192.168.25.128/192.168.25.128:2181. Will not attempt to authenticate using SASL (unknown error)
2017-11-13 09:27:28,778 [localhost-startStop-1-SendThread(192.168.25.128:2181)] [org.apache.zookeeper.ClientCnxn]-[WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

解决方案:关闭防火墙

这里写图片描述

几条关于防火墙的命令:

1.查看状态:firewall-cmd -state
开启状态:running
关闭状态:not running
2.关闭防火墙:systemctl stop firewalld.service
3.开机不启动防火墙:systemctl disable firewalld.service

之前查到的一些资料都是使用service而不是systemctl,其实也就是systemctl是新的指令,它融合之前service和chkconfig的功能于一体,更加强大,有兴趣的同学可以单独的查一些资料

我是在eclipse上引用dubbo服务连接zookeeper时出现了问题,问题代码如下: 2017-08-30 20:44:22,156 [localhost-startStop-1] [org.apache.zookeeper.ClientCnxn]-[DEBUG] zookeeper.disableAutoWatchReset is false 2017-08-30 20:44:22,182 [localhost-startStop-1] [org.I0Itec.zkclient.ZkClient]-[DEBUG] Awaiting connection to Zookeeper server 2017-08-30 20:44:22,192 [localhost-startStop-1-SendThread(192.168.139.176:9090)] [org.apache.zookeeper.ClientCnxn]-[INFO] Opening socket connection to server 192.168.139.176/192.168.139.176:9090. Will not attempt to authenticate using SASL (unknown error) 2017-08-30 20:44:23,195 [localhost-startStop-1-SendThread(192.168.139.176:9090)] [org.apache.zookeeper.ClientCnxn]-[WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) 2017-08-30 20:44:23,197 [localhost-startStop-1-SendThread(192.168.139.176:9090)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown input java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) 2017-08-30 20:44:23,197 [localhost-startStop-1-SendThread(192.168.139.176:9090)] [org.apache.zookeeper.ClientCnxnSocketNIO]-[DEBUG] Ignoring exception during shutdown output 之后就是无限循环最后那个异常。有没有大神能帮忙解决这个问题?
zookeeper我是按照视频上 演示的方法来启动的也成功 WARN [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection timed out: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) DEBUG [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Ignoring exception during shutdown input java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) DEBUG [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Ignoring exception during shutdown output java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797) at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) INFO [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Opening socket connection to server 192.168.25.167/192.168.25.167:2181. Will not attempt to authenticate using SASL (unknown error) WARN [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection timed out: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) DEBUG [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Ignoring exception during shutdown input java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:780) at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:399) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:200) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) DEBUG [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Ignoring exception during shutdown output java.nio.channels.ClosedChannelException at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:797) at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:407) at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:207) at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1246) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1170) INFO [localhost-startStop-1-SendThread(192.168.25.167:2181)] - Opening socket connection to server 192.168.25.167/192.168.25.167:2181. Will not attempt to authenticate using SASL (unknown error)
©️2020 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页