Dubbo Spring Cloud 多注册中心支持
Nacos
依赖
<!-- Spring Cloud Nacos Service Discovery -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
配置
bootstrap.yaml
spring:
cloud:
nacos:
username: test
password: test
discovery:
enabled: true
register-enabled: true
server-addr: 192.168.1.5:8848
context-path: /nacos
file-extension: yaml
group: dev/test/prod
namespace: appblog
timeout: 6000
ephemeral: false
# 消费方需配置
ribbon:
nacos:
enabled: true
Eureka
依赖
<!-- Eureka Service Discovery -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
配置
bootstrap.yaml
eureka:
client:
enabled: true
service-url:
defaultZone: http://127.0.0.1:8761/eureka/
Zookeeper
依赖
<!-- Zookeeper Service Discovery -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zookeeper-discovery</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>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>${curator.version}</version>
</dependency>
配置
bootstrap.yaml
spring:
cloud:
zookeeper:
enabled: true
connect-string: 127.0.0.1:2181
Consul
依赖
<!-- Spring Cloud Consul Service Discovery -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
<version>${spring-cloud-consul.version}</version>
</dependency>
配置
bootstrap.yaml
spring:
cloud:
consul:
enabled: true
host: 127.0.0.1
port: 8500
版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/04/01/dubbo-spring-cloud-multi-registry-support/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
打赏
海报
Dubbo Spring Cloud 多注册中心支持
Nacos
依赖
<!-- Spring Cloud Nacos Service Discovery -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artif……
文章目录
关闭
共有 0 条评论