SpringCloud 安裝Zookeeper

2023-12-04 16:22 更新

有關(guān)如何安裝Zookeeper的說明,請參閱安裝文檔。

Spring Cloud Zookeeper在后臺使用Apache Curator。盡管Zookeeper開發(fā)團隊仍將Zookeeper 3.5.x視為“測試版”,但實際情況是,許多用戶在生產(chǎn)中使用了它。但是,Zookeeper 3.4.x也用于生產(chǎn)中。在Apache Curator 4.0之前,兩個版本的Apache Curator支持Zookeeper的兩個版本。從Curator 4.0開始,兩個Zookeeper版本都通過相同的Curator庫支持。

如果要與版本3.4集成,則需要更改curator附帶的Zookeeper依賴項,并因此更改spring-cloud-zookeeper為此,只需排除該依賴性并添加如下所示的3.4.x版本。

專家。 

<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>

搖籃。 

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'
}

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號