• dubbo注册到 zookeeper + 使用apollo配置中心整合


    一、provider (供应者)

    pom依赖

    <dependency>
                <groupId>com.ctrip.framework.apollo</groupId>
                <artifactId>apollo-client</artifactId>
                <version>1.7.0</version>
            </dependency>
    
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-framework</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-recipes</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.apache.curator</groupId>
                <artifactId>curator-x-discovery</artifactId>
            </dependency>
    
            <dependency>
                <groupId>com.github.sgroschupf</groupId>
                <artifactId>zkclient</artifactId>
                <version>0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>slf4j-log4j12</groupId>
                        <artifactId>org.slf4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>slf4j-log4j12</groupId>
                        <artifactId>org.slf4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

    本地application.yml配置

    app:
      id: CFCA-PROVIDER
    apollo:
      bootstrap:
        namespaces: application
        enabled: true
        eagerLoad:
          enabled: true
      meta: http://localhost:8080

    apollo   yml配置(该配置直接配置在了apollo上)

    dubbo.application.name = cfca-provider
    dubbo.scan.base-packages = com.wlyuan.cfca.application.service
    dubbo.registry.address = zookeeper://localhost:2181
    dubbo.registry.register = true
    dubbo.protocol.name = dubbo
    dubbo.protocal.port = 20880
    dubbo.register.timeout = 100000

    二、consumer (消费者)

    pom依赖

    <dependency>
                <groupId>com.ctrip.framework.apollo</groupId>
                <artifactId>apollo-client</artifactId>
            </dependency>
    
    
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>com.github.sgroschupf</groupId>
                <artifactId>zkclient</artifactId>
                <version>0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>slf4j-log4j12</groupId>
                        <artifactId>org.slf4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>slf4j-log4j12</groupId>
                        <artifactId>org.slf4j</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

    本地application.yml配置

    spring:
      main:
        allow-bean-definition-overriding: true
    
    app:
      id: CFCA-CONSUMER
    apollo:
      bootstrap:
        namespaces: application
        enabled: true
        eagerLoad:
          enabled: true
      meta: http://localhost:8080

    apollo yml 配置

    dubbo.application.name = cfca-consumer
    dubbo.registry.address = zookeeper://localhost:2181
    dubbo.registry.register = true
    dubbo.registry.check = false
    dubbo.protocol.name = dubbo
    dubbo.protocal.port = 20880
    dubbo.register.timeout = 100000
  • 相关阅读:
    jQuery5事件相关
    jQuery4操作表单+属性+样式
    ueditor不能上传mp4格式的视频--解决方案
    笔记本怎么设置WIfi热点
    em rem vw vh
    字体的使用,坑爹啊!
    font的使用
    photoshop简单切图
    HTTP的学习
    call apply bind的联系与区别
  • 原文地址:https://www.cnblogs.com/ushowtime/p/15993673.html
Copyright © 2020-2023  润新知