1.zookeeper连接失败
1. 检查服务器的zookeeper端口是否开放,默认为2181
2. 检查zookeeper是否运行成功
# 进入bin文件夹
cd /usr/local/zookeeper/bin
# 重启
zkServer.sh restart
# 查看状态
zkServer.sh status
# 使用客户端进行连接
zkCli.sh
# 根据zookeeper.out排错
3. 目前dubbo使用curator4.X作为zookeeper的客户端,但curator4.X不支持3.4.X 只支持3.5.X
修改pom.xml
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>${dubbo.version}</version>
<type>pom</type>
<!-- 4.0.0原生不兼容zk 3.4, 必须进行兼容性处理 -->
<exclusions>
<exclusion>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.8</version>
</dependency>