Zookeeper 错误 Will not attempt to authenticate using SASL (unknown error)

今天在做dubbo实验的时候,碰到一个问题,卡了我7-8小时,差了很多资料无果,错误如下

2016-10-09 02:23:27,292 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=1.1.1.2:2181 sessionTimeout=60000 watcher=org.I0Itec.zkclient.ZkClient@3f74cc4e
2016-10-09 02:23:27,307 INFO [org.I0Itec.zkclient.ZkClient] - Waiting for keeper state SyncConnected
2016-10-09 02:23:32,308 INFO [org.I0Itec.zkclient.ZkEventThread] - Terminate ZkClient event thread.
2016-10-09 02:23:36,665 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 1.1.1.2/1.1.1.2:2181. Will not attempt to authenticate using SASL (unknown error)
2016-10-09 02:23:36,667 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to 1.1.1.2/1.1.1.2:2181, initiating session
2016-10-09 02:23:36,690 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server 1.1.1.2/1.1.1.2:2181, sessionid = 0x57a5203af30018, negotiated timeout = 40000
2016-10-09 02:23:36,699 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x57a5203af30018 closed
2016-10-09 02:23:36,702 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down
2016-10-09 02:23:36,703 WARN [org.springframework.context.support.ClassPathXmlApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sysUserService' defined in file [D:\linux_shared\myjavaproject\system_interchange\bhz-sys-service\target\classes\bhz\sys\service\SysUserService.class]: Initialization of bean failed; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)




最后发现是尝试,在我自己程序运行端(也就是java程序跑的所在机器,我自己的笔记本电脑上,加入了zk服务器的ip和服务器名映射关系,没想到竟然解决了,我只能说操蛋啊,查了几个小时,因为是spring或者是程序配置问题,主要引起我注意的是Will not attempt to authenticate using SASL (unknown error)那句。。。)


1.这里1.1.1.2是zk的服务器端IP地址,我在服务器上也配置了1.1.1.2和服务器本机的IP地址映射关系,不然也可以出问题

2.在  C:\Windows\System32\drivers\etc\hosts 里加入 1.1.1.2  ubuntu16这句话,问题就解决了。。。

3.补充一下,发现zk服务器端不配置映射关系似乎也可以用,但是zk客户端,是一定要配置的


  • 28
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 21
    评论
评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值