springCloud集成Dubbo,使用redis做注册中心

springCloud怎么集成Dubbo可以看我的另一篇文章,


springCloud集成Dubbo简单记录 - JAVA_HIGHNESS的专栏 - CSDN博客
https://blog.csdn.net/javahighness/article/details/82719083


首先,maven添加redis依赖,



      org.springframework.boot
      spring-boot-starter-data-redis
      1.5.9.RELEASE
  

然后只需修改配置文件 application.yml , 把zookeeper的地址改为redis的地址即可。

生产者 dubbo-producer 配置

## dubbo springboot 配置
    dubbo:
        application:
            id: live-dubbo-provider
            name: live-dubbo-provider
        registry:
#            address: zookeeper://127.0.0.1:2181
            address: redis://127.0.0.1:6379
        server: true
        protocol:
            name: dubbo
            port: 20888

消费者 dubbo-consumer 配置

#  dubbo springboot 配置
    dubbo:
        application:
            id: live-dubbo-consumer
            name: live-dubbo-consumer
        registry:
#            address: zookeeper://127.0.0.1:2181
            address: redis://127.0.0.1:6379


你可能感兴趣的:(Dubbo,SpringCloud)