通过zookeeper搭建dubbo注册中心遇到的问题:
在linux下安装,配置并启动zookeeper。

在window环境下启动服务提供方时,未成功启动,报以下错误:

Opening socket connection to server 192.168.80.63/192.168.80.63:2181.Will not attempt to authentic

2017-03-02 19:52:32,270 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=192.168.153.128:2181 sessionTimeout=30000 watcher=org.I0Itec.zkclient.ZkClient@1d6ba2b
2017-03-02 19:52:32,288 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.153.128/192.168.153.128:2181. Will not attempt to authenticate using SASL (unknown error)
2017-03-02 19:52:53,291 WARN [org.apache.zookeeper.ClientCnxn] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection timed out: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
2017-03-02 19:52:54,394 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.153.128/192.168.153.128:2181. Will not attempt to authenticate using SASL (unknown error)

解决方案,服务器中检查以下内容:

1.  zookeeper的服务没有开启

    执行./zkServer.sh start

2.  访问不到zookeeper中心是因为   需要关闭防火墙:service iptables stop 否则访问不到2181端口

3.  注意配置中的zookeeper的ip地址是否写错,测试环境ip地址写错也有可能。比如我这个项目好久没跑,默认用的ip是192.168.80.63,而我自己布的zk在192.168.80.62。唠叨这么多,菜鸟的很多问题基本都是配置问题。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐