我的应用程序正在尝试连接到 Zookeeper @ localhost:2181。 Zookeeper 正在运行并在命令提示符下进行检查。但是,当应用程序运行时,我反复看到以下异常:
2018-08-06 22:25:09 DEBUG ZkClient:919 - Closing ZkClient...
2018-08-06 22:25:09 INFO ZkEventThread:82 - Terminate ZkClient event thread.
2018-08-06 22:25:09 DEBUG ZkConnection:77 - Closing ZooKeeper connected to localhost:2181
2018-08-06 22:25:09 DEBUG ZooKeeper:673 - Closing session: 0x0
2018-08-06 22:25:09 DEBUG ClientCnxn:1306 - Closing client for session: 0x0
2018-08-06 22:25:10 INFO ClientCnxn:975 - Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-08-06 22:25:10 DEBUG ClientCnxn:1086 - An exception was thrown while closing send thread for session 0x0 : Connection refused
2018-08-06 22:25:10 DEBUG ClientCnxnSocketNIO:203 - 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:1185)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1122)
2018-08-06 22:25:10 DEBUG ClientCnxnSocketNIO:210 - 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:1185)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1122)
2018-08-06 22:25:10 DEBUG ClientCnxn:1290 - Disconnecting client for session: 0x0
2018-08-06 22:25:10 INFO ZooKeeper:684 - Session: 0x0 closed
2018-08-06 22:25:10 DEBUG ZkClient:932 - Closing ZkClient...done
2018-08-06 22:25:10 INFO ClientCnxn:512 - EventThread shut down
而且,日志里还写着
ClientCnxn:975 - Opening socket connection to server localhost.localdomain/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
这意味着它正在尝试连接 localhost.localdomain 吗?
请帮我解决。
我也有类似的问题。我在zoo.cfg中配置了以下参数(C:\kafka_folder\zookeeper-3.5.