72. 安装 Zookeeper

有关如何安装 Zookeeper 的说明,请参阅安装文档

Spring Cloud Zookeeper 在幕后使用 Apache 策展人。虽然 Zookeeper 3.5.x 仍然被 Zookeeper 开发团队认为是“测试版”,但实际情况是它被许多用户用于生产。但是,Zookeeper 3.4.x 也用于 production。在 Apache Curator 4.0 之前,Zookeeper 的两个版本都是通过两个版本的 Apache Curator 支持的。从 Curator 4.0 开始,Zookeeper 的两个版本都通过相同的 Curator libraries 支持。

如果要与 version 3.4 集成,则需要更改curator附带的 Zookeeper 依赖项,从而更改spring-cloud-zookeeper。为此,只需排除该依赖项并添加 3.4.x version,如下所示。

行家.

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-zookeeper-all</artifactId>
    <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.12</version>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
    </exclusions>
</dependency>

gradle 这个.

compile('org.springframework.cloud:spring-cloud-starter-zookeeper-all') {
  exclude group: 'org.apache.zookeeper', module: 'zookeeper'
}
compile('org.apache.zookeeper:zookeeper:3.4.12') {
  exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}