`

服务注册不上zookeeper中心(Will not attempt to authenticate using SASL (unknown error) )

 
阅读更多

1,错误现象:

 

service日志正常启动,唯一的问题是没有注册上zookeeper,看service日志,发现如下错误

 

错误日志 

 

[2019-11-06 02:44:22,894] INFO [ZooKeeper] Initiating client connection, connectString=192.168.1.83:2181,192.168.1.84:2181,192.168.1.85:2181 sessionTimeout=60000 watcher=org.apache.curator.ConnectionState@6d2d99fc

[2019-11-06 02:44:22,902] INFO [X509Util] Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation

[2019-11-06 02:44:22,912] INFO [ClientCnxnSocket] jute.maxbuffer value is 4194304 Bytes

[2019-11-06 02:44:22,923] INFO [ClientCnxn] zookeeper.request.timeout value is 0. feature enabled=

[2019-11-06 02:44:22,937] INFO [ClientCnxn] Opening socket connection to server 192.168.1.83/192.168.1.83:2181. Will not attempt to authenticate using SASL (unknown error)

[2019-11-06 02:44:22,949] INFO [ClientCnxn] Socket connection established, initiating session, client: /10.10.134.11:16505, server: 192.168.1.83/192.168.1.83:2181

[2019-11-06 02:44:22,962] INFO [ClientCnxn] Session establishment complete on server 192.168.1.83/192.168.1.83:2181, sessionid = 0x16e0e76b9c20047, negotiated timeout = 40000

[2019-11-06 02:44:22,975] INFO [ConnectionStateManager] State change: CONNECTED

 

都是info日志,仔细看,看出来,注册没有成功,链接超时了

尤其是这一句 

Opening socket connection to server 192.168.1.83/192.168.1.83:2181. Will not attempt to authenticate using SASL (unknown error)

2,问题分析

 

1)  因为这一句

 

Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation

一开始怀疑jdk有问题,service依赖的jdk1.8 而zookeeper 3.4.8 应该是1.7的,所以不支持,所以换jdk,但是仍然有问题,最开始搜

 

 

2)那就怀疑其他问题了,

 

Opening socket connection to server 192.168.1.83/192.168.1.83:2181. Will not attempt to authenticate using SASL (unknown error)

那就是跟zookeeper的集群不知什么原因没有建立链接,而且超时了,

 

参考文章https://stackoverflow.com/questions/29056195/not-attempt-to-authenticate-using-sasl-unknown-error

 

继续搜索,发现网上有体到maxClientCnxns这个参数的事情,而

默认zookeeper给每个客户端IP使用的连接数为10个,经常会出现连接不够用的情况。修改连接数目前好像只支持zoo.cfg配置文件修改,所以需要zookeeper重启才能生效。

 

而83机器的zoo.cfg配置中maxClientCnxns=60 根本没有放开

 

zoo.cfg 

 

# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60

 

3)另外得知 service的机器134.11上已经布置了另一台service,应该是连接数被占用满了,另外集群83,84,85上也看到同134.11建立的tcp连接(netstat -an|grep 2181)

 

 

 

3,解决办法

 

       将交易的service服务,布置到另外一台没有任何应用的机器上,启动,成功!

 

4,总结

 

      这次看zoo.cfg发现两个漏洞

 

      1)maxClientCnxns这个参数没有放开,可以放开,重启zookeeper,考虑到重启zookeeper风险会比重启一个应用的风险大,就没有重启

 

      2)zookeeper.out 文件日志量太大,需要定期清理 

 

5,zoo.cfg 模块分析

 

zoo.cfg分析 

 

# The number of milliseconds of each tick 单位毫秒,默认3000,可以不配置,不支持系统属性方式配置

参数tickTime用于配置zookeeper中最小时间单元的长度,很多运行时的时间间隔dou'shidoushi 使用tickTime的倍数来表示的

例如:zookeeper的最小超时时间默认为2*tickTime

tickTime=2000

# The number of ticks that the initial

# synchronization phase can take

表示tickTime值的十倍,用于配置leader服务器等待Follower启动,并完成数据同步的时间。Follower服务器在启动的过程中,会与Leader建立连接并

完成数据的同步,从而确定自己对外提供服务的起始状态,Leader服务器允许Follwer在initLimit时间内完成这个工作,一般不需要关注,如果集群数量太大,同步时间也会太长,担心时间不够,可以适当修改参数

一般不需要调大这个参数

initLimit=10

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

用于配置Leader服务器和Follwer之间进行心跳检测的最大延迟时间,如果网络质量较低,可以适当调大这个参数

syncLimit=5

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes. 快照文件的目录

dataDir=/zookeeper/data

#事务文件文件的目录

dataLogDir=/zookeeper/log

# the port at which the clients will connect

服务器对外端口

clientPort=2181

# the maximum number of client connections.

# increase this if you need to handle more clients

#默认60 从socket层面限制单个客户端与单台服务器之间的连接并发数,即从IP地址粒度来进行连接数的限制,如果为0,代表不限制

#3.4.0 之前默认为10,3.4.0版本开始变成60

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

#从3.4.0 开始zookeeper提供了支持对历史事务日志和快照数据自动清理的支持,<3 会自动调整到3

#autopurge.snapRetainCount=3

# Purge task interval in hours

# Set to "0" to disable auto purge feature

#单位是小时,跟autopurge.snapRetainCount 配套使用,如果为0,代表不开启定时清理功能

#autopurge.purgeInterval=1

#集群列表

server.1=slave-01:2888:3888

server.2=slave-02:2888:3888

server.3=slave-03:2888:3888

 

 

分享到:
评论

相关推荐

    zookeeper构建集群实用教程

    本教程清晰地介绍的zookeeper构建集群的完整过程,可以在本地环境下安装和拷贝出多个VMware虚拟机,然后通过zookeeper将多个VMware虚拟机构建成一个集群

    Kafka 使用

    简介 Zookeeper搭建 bin/zkServer.sh start ... Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn) [2020-02-19 14:58:13,672] WARN Session 0x0 for serve

    zookeeper-3.4.14.jar

    解决Opening socket connection to server 172.31.0.3/172.31.0.3:2181. Will not attempt to authenticate using SASL (unknown error)

    zookeeper注册中心下载

    zookeeper注册中心下载,下载后直接放到Tomcat下,然后启动tomcat就会自动将war包解压,然后关闭tomcat,再次启动就行再次启动就行

    ZooKeeper注册中心安装详细步骤

    ZooKeeper注册中心安装详细步骤

    ZooKeeper3.4.6-注册中心安装步骤及安装包

    zookeeper3.4.6安装包,ZooKeeper注册中心安装详细步骤(单节点)

    zookeeper在线注册服务查看工具

    可视化的在线zookeeper服务查看,可以查看线上服务的注册清空,便于开发的同学寻找bug,调试代码

    SpringCloud——Zookeeper(注册中心)

    Zookeeper作为注册中心搭建SpringCloud实现服务注册及发现

    Zookeeper单节点注册中心

    Zookeeper单节点注册中心

    Dubbo无法访问远程Zookeeper已注册服务的问题解决方案

    今天小编就为大家分享一篇关于Dubbo无法访问远程Zookeeper已注册服务的问题解决方案,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧

    zookeeper-3.4.8服务

    zookeeper-3.4.8服务

    基于Zookeeper集群环境下的服务注册代码

    zookeeper作为如今分布式应用下常用的开发技术,已经广泛应用于各种...该项目介绍了zookeeper的服务注册功能,使用了zookeeper集群环境搭建,可参考博客:https://blog.csdn.net/LiaoHongHB/article/details/84950486

    zookeeper-3.5.4windows服务注册包

    鉴于官方zookeeper在windows上部署需要手动启动,特别封装好可以自动安装windows服务的zookeeper-3.5.4windows服务注册包

    5、zookeeper的java -Curator(服务注册与发现)

    5、zookeeper的java -Curator(服务注册与发现) 网址:https://blog.csdn.net/chenwewi520feng/article/details/130320669 本文介绍使用zookeeper的Curator类库实现服务的注册与发现。 该示例会涉及到本专栏下的...

    Java-zookeeper实践代码(分布式锁/注册中心)

    学习时个人编写的样例代码,通过zookeeper实现分布式锁与简单的注册中心

    基于zookeeper注册发现服务的springbootDemo

    本人亲自写的demo,确定可以运行。项目是基于springboot的zookeeper环境下,服务注册及发现demo。包内有具体说明。下载后,如有疑问可以发消息我。

    zookeeper安装包 支持window

    Zookeeper是一个分布式的服务框架,是树型的目录服务的数据存储,能做到集群管理数据 ,这里能很好的作为Dubbo服务的注册中心。 Dubbo能与Zookeeper做到集群部署,当提供者出现断电等异常停机时,Zookeeper注册中心...

    dubbo和zookeeper的关系.rar

    在Dubbo架构中,服务提供者将自己注册到Zookeeper中心节点的一个子节点上,而服务消费者则从Zookeeper中心节点查询服务提供者的信息。通过这种方式,Dubbo可以实现高效的服务发现和负载均衡。 以下是一个简单的示例...

    Dubbo zookeeper注册中心文档

    Zookeeper一个分布式的服务框架,是树型的目录服务的数据存储,能做到集群管理数据 ,这里能很好的作为Dubbo服务的注册中心,Dubbo能与Zookeeper做到集群部署,当提供者出现断电等异常停机时,Zookeeper注册中心能...

    Zookeeper安装

    一、实验要求 完成Zookeeper的完全分布模式的安装 Zookeeper服务能够正常... Zookeeper采用的投票算法要求至少有3个及其以上的服务节点,且服务节点为奇数时为最有效的配置,所以将集群的五台主机全部作为服务节点。

Global site tag (gtag.js) - Google Analytics