21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA> 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:os.version=3.10.0-1160.25.1.el7.x86_64 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:user.name=root 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:user.home=/root 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Client environment:user.dir=/root 21/08/03 17:02:16 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=10.0.0.87:2181/kafka sessionTimeout=30000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@346d61be 21/08/03 17:02:16 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:16 INFO zookeeper.ZooKeeperClient: [ZooKeeperClient] Waiting until connected. 21/08/03 17:02:16 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: 拒绝连接 ????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:350) ????at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1224) 21/08/03 17:02:17 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:17 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: 拒绝连接 ????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:350) ????at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1224) 21/08/03 17:02:18 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:18 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: 拒绝连接 ????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:350) ????at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1224) 21/08/03 17:02:19 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:19 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: 拒绝连接 ????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:350) ????at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1224) 21/08/03 17:02:20 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:20 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: 拒绝连接 ????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:350) ????at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1224) 21/08/03 17:02:21 INFO zookeeper.ClientCnxn: Opening socket connection to server kafka1/10.0.0.187:2181. Will not attempt to authenticate using SASL (unknown error) 21/08/03 17:02:21 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
解决办法:
开始时候配置了这个,但发现没有用

?

zoo.cfg 的 Server? 高级配置代码段(安全阀) 添加?client.sasl=false? 重启
后来检查zk节点的防火墙发现防火墙开了

sytemctl stop iptables 关闭防火墙
kafka-topics --zookeeper zok2:2181/kafka --create -replication-factor 1 --partitions 3 --topic test
kafka-topics --list --zookeeper zok2:2181? ?

?成功看到,所以结论就是防火墙没关,需要关掉
?
|