Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeepe

2022-03-07 13:56:56 浏览数 (1)

个人简介

我是廖志伟,一名Java开发工程师,CSDN博客专家,Java领域优质创作者,《幕后大佬》社区创始人,《南北踏尘》微信公众号创始人。多年一线研发经验,曾就职多家互联网公司,参与并主导多个百万级并发的互联网产品研发与系统架构搭建,对大型分布式,高并发及微服务架构,缓存框架有非常深入的研究,对于中间件底层,架构搭建,系统调优颇多经验。

博主:java_wxid 社区:幕后大佬

本文的大概内容:

一、业务场景:报错kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING

我通过docker命令启动kafka,进入kafka容器之后,过一二秒没做操作,就出现退出容器的情况,通过zookeeper客户端连接kafka配置的zookeeper发现可以连接的上,但是查看kafka日志却报错kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING

二、错误日志:Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)

代码语言:javascript复制
[2021-11-16 13:39:02,215] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-16 13:39:02,215] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-16 13:39:02,219] INFO Initiating client connection, connectString=106.14.132.94:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@4466af20 (org.apache.zookeeper.ZooKeeper)
[2021-11-16 13:39:02,241] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2021-11-16 13:39:02,248] INFO zookeeper.request.timeout value is 0. feature enabled= (org.apache.zookeeper.ClientCnxn)
[2021-11-16 13:39:02,256] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2021-11-16 13:39:12,261] INFO Opening socket connection to server 106.14.132.94/106.14.132.94:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-11-16 13:39:12,268] INFO Socket error occurred: 106.14.132.94/106.14.132.94:2181: Host is unreachable (org.apache.zookeeper.ClientCnxn)
[2021-11-16 13:39:20,258] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2021-11-16 13:39:23,377] INFO Opening socket connection to server 106.14.132.94/106.14.132.94:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-11-16 13:39:23,482] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2021-11-16 13:39:23,483] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2021-11-16 13:39:23,485] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2021-11-16 13:39:23,492] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
    at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:262)
    at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:119)
    at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1881)
    at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:441)
    at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:466)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:233)
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
    at kafka.Kafka$.main(Kafka.scala:82)
    at kafka.Kafka.main(Kafka.scala)
[2021-11-16 13:39:23,496] INFO shutting down (kafka.server.KafkaServer)
[2021-11-16 13:39:23,502] INFO App info kafka.server for 0 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2021-11-16 13:39:23,503] INFO shut down completed (kafka.server.KafkaServer)
[2021-11-16 13:39:23,503] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
[2021-11-16 13:39:23,506] INFO shutting down (kafka.server.KafkaServer)

由于kafka运行是通过docker镜像的方式运行的,而且zookeeper外部的客户端也可以连接上zookeeper就排除了,zookeeper的异常情况,那么剩下的只可能是kafka运行的命令出问题了,我之前的运行命令如下:

代码语言:javascript复制
docker run -dit --restart=always --log-driver json-file --log-opt max-size=100m --log-opt max-file=2 --name kafka 
-p 9092:9092 
-e KAFKA_BROKER_ID=0 
-e KAFKA_ZOOKEEPER_CONNECT=106.14.132.94:2181 
-e KAFKA_ADVERTISED_HOST_NAME=106.14.132.94 
-e KAFKA_ADVERTISED_PORT=9092 
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://106.14.132.94:9092 
-e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 
-v /etc/localtime:/etc/localtime 
-t wurstmeister/kafka

把监听的0.0.0.0改成服务器ip地址

代码语言:javascript复制
docker run -dit --restart=always --log-driver json-file --log-opt max-size=100m --log-opt max-file=2 --name kafka 
-p 9092:9092 
-e KAFKA_BROKER_ID=0 
-e KAFKA_ZOOKEEPER_CONNECT=106.14.132.94:2181 
-e KAFKA_ADVERTISED_HOST_NAME=106.14.132.94 
-e KAFKA_ADVERTISED_PORT=9092 
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://106.14.132.94:9092 
-e KAFKA_LISTENERS=PLAINTEXT://106.14.132.94:9092 
-v /etc/localtime:/etc/localtime 
-t wurstmeister/kafka

但是还是有出错的情况: Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn) Host is unreachable (org.apache.zookeeper.ClientCnxn)

代码语言:javascript复制
[2021-11-16 15:20:11,821] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.version=5.10.60-9.al8.x86_64 (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:user.name=root (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:user.home=/root (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:user.dir=/ (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.memory.free=973MB (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,821] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,838] INFO Initiating client connection, connectString=106.14.132.94:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@4466af20 (org.apache.zookeeper.ZooKeeper)
[2021-11-16 15:20:11,857] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2021-11-16 15:20:11,864] INFO zookeeper.request.timeout value is 0. feature enabled= (org.apache.zookeeper.ClientCnxn)
[2021-11-16 15:20:11,871] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2021-11-16 15:20:21,879] INFO Opening socket connection to server 106.14.132.94/106.14.132.94:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2021-11-16 15:20:21,885] INFO Socket error occurred: 106.14.132.94/106.14.132.94:2181: Host is unreachable (org.apache.zookeeper.ClientCnxn)

奇怪的是zookeeper的节点有kafka相关的数据了

SASL全称Simple Authentication and Security Layer,是一种用来扩充C/S模式验证能力的机制。

三、解决方案

网上百度了一堆没用的,我一一列举出来 第一个说是通过官网发现,在zookeeper 3.4.5之前,sasl认证是没有办法规避的,在3.4.6版本后修复了这个bug,因为不停的去检测认证虽然对功能没有什么影响,但是比较耗费服务器性能,比较占用容器资源。zk升级到3.4.6 的版本,可我的版本是zookeeper-3.4.13,肯定是符合的,无效。 第二个说是让zookeeper绕过sasl安全机制,禁用sasl认证,直接向系统获取资源。在conf目录下的zoo.cfg文件添加配置,zookeeper.sasl.client=false,然后重启zookeeper,亲身试过,无效。 第三个说是端口开放的问题,防火墙啊,入口和出口规则限制啊,这些符合,因为我可以通过客户端工具连接zookeeper,所以不存在端口问题,无效。 第四个说是给zookeeper做安全配置,但是我的初衷是对Kafka客户端使用SASL身份验证,但不要求kafka对Zookeeper进行SASL身份验证,我不关心kafka < - > zookeeper之间的安全校验问题,我就想单纯的通过docker进行运行kafka,可以让我进到容器内部进行测试发送消息。所以我还在寻找绕开sasl认证的办法,通过在apache bug管理官网:https://issues.apache.org/jira/browse/ZOOKEEPER-1657,我大致看了看还是和上面类似的解决方案。

大致的意思就跟第一个说的差不多,不停的去检测认证虽然对功能没有什么影响,但是比较耗费服务器性能,比较占用容器资源。 下面的解决方案也如出一辙。

除此之外,还发现了一篇帖子的解决方案也大体相同

只不过我都尝试过,发现都不起效果。 然后我去查看有关SASL配置项

X509AuthenticationProvider.superUser:Java系统属性:zookeeper.X509AuthenticationProvider.superUser)支持SSL的方法,使ZooKeeper集合管理员能够以“超级”用户身份访问znode层次结构。当此参数设置为X500主体名称时,只有具有该主体的经过身份验证的客户端才能绕过ACL检查并拥有所有znode的完全权限。 zookeeper.superUser:Java系统属性:zookeeper.superUser)与zookeeper.X509AuthenticationProvider.superUser类似,但对于基于SASL的登录是通用的。它存储可以作为“超级”用户访问znode层次结构的用户的名称。

看了这些配置,发现并没什么作用。到这里我基本放弃了绕开sasl认证的办法了,网上也找不到更多有用的消息,还不如老老实实的配置安全认证,这里我参考了二篇博文,第一篇是集群模式的:https://blog.csdn.net/sdksdk0/article/details/95336382,第二篇是https://www.orchome.com/553。又熬到快十二点半了,熬不动了,睡觉睡觉,希望有大神可以帮忙解决这个绕开sasl认证的问题,至于权限认证的问题,等也时间再慢慢实现。这里我提供kafka和zookeeper的启动命令给大神作参考。 具体实现可参考:https://liaozhiwei.blog.csdn.net/article/details/120716913

早上起床接着排查 第五个说的是zookeeper客户端 和服务器连接时版本问题,不过我并没有用程序连接,无效

第六个说的是zookeeper服务器主动断开与客户端的连接问题,修改配置,无效

这个时候我去看了看zookeeper的日志信息,发现也报错了

这个时候,我将之前改过的配置都还原,把原有的镜像都删除,重新启动docker运行镜像 kafka

代码语言:javascript复制
docker run -dit --restart=always --log-driver json-file --log-opt max-size=100m --log-opt max-file=2 --name kafka 
-p 9092:9092 
-e KAFKA_BROKER_ID=0 
-e KAFKA_ZOOKEEPER_CONNECT=106.14.132.94:2181 
-e KAFKA_ADVERTISED_HOST_NAME=106.14.132.94 
-e KAFKA_ADVERTISED_PORT=9092 
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://106.14.132.94:9092 
-e KAFKA_LISTENERS=PLAINTEXT://106.14.132.94:9092 
-v /etc/localtime:/etc/localtime 
-t wurstmeister/kafka

zookeeper

代码语言:javascript复制
docker run -dit --restart=always --log-driver json-file --log-opt max-size=100m --log-opt max-file=2  --name zookeeper 
-p 2181:2181 
-v /etc/localtime:/etc/localtime 
-t wurstmeister/zookeeper

然后发现zookeeper的错误信息日志

代码语言:javascript复制
2021-11-18 00:11:05,537 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57390 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:05,537 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57390 (no session established for client)
2021-11-18 00:11:07,162 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57843
2021-11-18 00:11:07,162 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57843 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:07,163 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57843 (no session established for client)
2021-11-18 00:11:09,310 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57534
2021-11-18 00:11:09,318 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57534 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:09,318 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57534 (no session established for client)
2021-11-18 00:11:10,942 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57699
2021-11-18 00:11:10,943 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57699 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:10,943 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57699 (no session established for client)
2021-11-18 00:11:12,684 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57568
2021-11-18 00:11:12,695 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57568 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:12,696 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57568 (no session established for client)
2021-11-18 00:11:14,703 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57601
2021-11-18 00:11:14,743 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@922] - Refusing session request for client /114.87.234.228:57601 as it has seen zxid 0x7 our last zxid is 0x0 client must try another server
2021-11-18 00:11:14,743 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57601 (no session established for client)
2021-11-18 00:11:15,412 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57800
2021-11-18 00:11:15,414 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@949] - Client attempting to establish new session at /114.87.234.228:57800
2021-11-18 00:11:15,416 [myid:] - INFO  [SyncThread:0:FileTxnLog@213] - Creating new log file: log.1
2021-11-18 00:11:15,427 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@694] - Established session 0x100137139d30000 with negotiated timeout 5000 for client /114.87.234.228:57800
2021-11-18 00:11:16,843 [myid:] - INFO  [ProcessThread(sid:0 cport:2181)::PrepRequestProcessor@487] - Processed session termination for sessionid: 0x100137139d30000
2021-11-18 00:11:16,845 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57800 which had sessionid 0x100137139d30000
2021-11-18 00:11:17,354 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57488
2021-11-18 00:11:17,354 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@949] - Client attempting to establish new session at /114.87.234.228:57488
2021-11-18 00:11:17,356 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@694] - Established session 0x100137139d30001 with negotiated timeout 5000 for client /114.87.234.228:57488
2021-11-18 00:11:18,817 [myid:] - INFO  [ProcessThread(sid:0 cport:2181)::PrepRequestProcessor@487] - Processed session termination for sessionid: 0x100137139d30001
2021-11-18 00:11:18,819 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57488 which had sessionid 0x100137139d30001
2021-11-18 00:11:19,344 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57417
2021-11-18 00:11:19,355 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@949] - Client attempting to establish new session at /114.87.234.228:57417
2021-11-18 00:11:19,357 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@694] - Established session 0x100137139d30002 with negotiated timeout 5000 for client /114.87.234.228:57417
2021-11-18 00:14:25,024 [myid:] - INFO  [ProcessThread(sid:0 cport:2181)::PrepRequestProcessor@487] - Processed session termination for sessionid: 0x100137139d30002
2021-11-18 00:14:25,026 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1056] - Closed socket connection for client /114.87.234.228:57417 which had sessionid 0x100137139d30002
2021-11-18 00:14:25,730 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@215] - Accepted socket connection from /114.87.234.228:57403
2021-11-18 00:14:25,731 [myid:] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@949] - Client attempting to establish new session at /114.87.234.228:57403
2021-11-18 00:14:25,733 [myid:] - INFO  [SyncThread:0:ZooKeeperServer@694] - Established session 0x100137139d30003 with negotiated timeout 5000 for client /114.87.234.228:57403

zookeeper客户端连接的截图

kafka的日志

代码语言:javascript复制
[2021-11-18 00:18:27,177] INFO Client environment:java.library.path=/usr/lib/jvm/zulu8-ca/jre/lib/amd64/server:/usr/lib/jvm/zulu8-ca/jre/lib/amd64:/usr/lib/jvm/zulu8-ca/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,177] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.version=5.10.60-9.al8.x86_64 (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:user.name=root (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:user.home=/root (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:user.dir=/ (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.memory.free=973MB (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.memory.max=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,178] INFO Client environment:os.memory.total=1024MB (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,182] INFO Initiating client connection, connectString=106.14.132.94:2181 sessionTimeout=18000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@4466af20 (org.apache.zookeeper.ZooKeeper)
[2021-11-18 00:18:27,215] INFO jute.maxbuffer value is 4194304 Bytes (org.apache.zookeeper.ClientCnxnSocket)
[2021-11-18 00:18:27,223] INFO zookeeper.request.timeout value is 0. feature enabled= (org.apache.zookeeper.ClientCnxn)
[2021-11-18 00:18:27,226] INFO [ZooKeeperClient Kafka server] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)

进入容器内部发送消息

代码语言:javascript复制
`bash-5.1# ./kafka-console-producer.sh --broker-list 106.14.132.94:9092 --topic sun

[2021-11-18 00:17:06,318] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,319] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,413] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,414] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,514] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,514] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,715] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:06,716] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:08,276] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:08,276] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:09,031] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:09,031] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:11,092] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:11,092] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:13,012] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:13,012] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:14,017] WARN [Producer clientId=console-producer] Connection to node -1 (/106.14.132.94:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2021-11-18 00:17:14,017] WARN [Producer clientId=console-producer] Bootstrap broker 106.14.132.94:9092 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient) `

又找了找,还是没什么用

用netstat查看网络连接状态

代码语言:javascript复制
netstat -antp | grep 2181

用tcpdump抓包和wireshark分析

代码语言:javascript复制
tcpdump -vv host 106.14.132.94 and port 2181 -w 2181.cap
tcpdump -r 2181.cap

没有发现什么有用信息,这个时候原来的sasl认证的错误信息没有了,出现了新的问题。 zookeeper还是老样子,可以连接上

后面我会持续更新这个bug的解决过程,直到彻底解决,也希望有大佬可以在评论区留下宝贵的经验,让我可以少走弯路。

总结

以上就是今天要讲的内容,还希望各位读者大大能够在评论区积极参与讨论,给文章提出一些宝贵的意见或者建议,合理的内容,我会采纳更新博文,重新分享给大家。

0 人点赞