windows10本地联调zk环境报异常SASL config status: Will not attempt to authenticate using SASL (unknown error)

感谢原文:https://blog.csdn.net/qq_43639296/article/details/123282280

SASL config status: Will not attempt to authenticate using SASL (unknown error)

 

报错:
org.apache.zookeeper.ClientCnxn$EndOfStreamException: Unable to read additional data from server sessionid 0x108e8afac8f0077, likely server has closed socket

报错:
org.apache.zookeeper.KeeperException$OperationTimeoutException: KeeperErrorCode = OperationTimeout

提示:
SASL config status: Will not attempt to authenticate using SASL (unknown error)

原因:
zookeeper默认使用了ZooKeeperSaslClient,而这个过程中调用了getHostName方法,这个方法会对传进去的字符串进行域名解析,即使是一个ip地址也会进行解析,而dns解析的快慢和服务器配置有关系,从而造成程序阻塞。

解决:
可以通过在hosts文件添加上zookeeper的ip地址,使得getHostName可以直接使用hosts里面的dns结果。

win10 hosts目录:C:\Windows\System32\drivers\etc\HOSTS

 

 

 

保存 ,完美解决连接超时问题

 

posted @ 2022-05-26 16:31  疯癫大圣  阅读(617)  评论(0编辑  收藏  举报