CDH6.3.2 kafka使用报错zookeeper.ClientCnxn: Opening socket connection to server xxxxx:2181.

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   

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

 

  • 20
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值