GithubHelp home page GithubHelp logo

dubbo-servicecomb's Introduction

Dubbo-Serivcecomb | 中文

Dubbo-Serivcecomb provide extensions for Apache Dubbo to using Cloud Service Engine, so that Dubbo users can use service center, config center and governance features.

Dubbo's versions before 2.7.x interface based discovery is used. After 2.7.x, users can also use service based discovery, which is widely used in Spring Cloud, ServiceComb and Istio.

Dubbo-ServiceComb provides service based discovery for all Dubbo's versions includes versions before 2.7.x. So that different versions of Dubbo applications can be managed by Cloud Service Engine.

Supported versions

Before reading the next contents, check the supported versions in different branch.

Branch Latest Version Dubbo Base Version Supported Dubbo Suggestions
2.6.x 1.1.3 2.6.9 2.6.x,Suggested upgrade to 2.6.9 or later
2.6.x 1.1.5-SNAPSHOT 2.6.9 2.6.x,Suggested upgrade to 2.6.9 or later
master 1.3.3 2.7.8 2.7.x,Suggested upgrade to 2.7.8 or later
master 1.3.5-SNAPSHOT 2.7.8 2.7.x,Suggested upgrade to 2.7.8 or later

Dubbo Microservice Concepts vs Dubbo-ServiceComb Concepts

  • Dubbo Microservice Concepts

    • application: microservice.
    • service:java interface。
  • Dubbo-ServiceComb Concepts

    • microservice: microservice.
    • application: A group of microservices fulfils user applications.
    • schema: java interface.

In the following chapters we use Dubbo-ServiceComb Concepts.

Dubbo Governance vs Dubbo-ServiceComb Governance

When Dubbo application starts up, it registers all governance properties to register center. Users change governance properties from Dubbo Admin, and Dubbo Admin will push changes to application. The internal governance feature will read the change and follow the instructions.

Dubbo-ServiceComb registers governance properties to config center. Users change configurations throw config center, and config center will push all change to the application.

Benefits and Drawbacks

  • Benefits

    • Add Service Based Discovery, so that different version can be manged together. And can inter-operate with other microservice framework.
    • Much less microservice instances. Each microservice has only one instance, while Dubbo instances is compared to interfaces.
    • Same governance procedure with Spring Cloud, ServiceComb. So that we can deploy different services together and managed with the same rule.
  • Drawbacks

    • Dubbo allows one interface has many implementations in different microservices, this is very useful for microservice split and combination.
    • Dubbo uses Dubbo Admin to change governance properties, while Dubbo ServiceComb cannot.

Quick Start

This quick start can be found in dubbo-servicecomb-sample.

  • Download Local CSE, run start.bat. After start up, using http://localhost:30106/ to open the console.

  • Config POM in project

      ```
      <dependency>
        <groupId>com.huaweicloud.dubbo-servicecomb</groupId>
        <artifactId>dubbo-servicecomb-service-center</artifactId>
      </dependency>
      <dependency>
        <groupId>com.huaweicloud.dubbo-servicecomb</groupId>
        <artifactId>dubbo-servicecomb-config-center</artifactId>
      </dependency>
      ```
    
  • Start Up using Spring

    In Spring Component scan, add classpath*:spring/dubbo-servicecomb.xml.

      ```
      public class PriceApplication {
        public static void main(String[] args) throws Exception {
          try {
            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                "classpath*:spring/dubbo-provider.xml", "classpath*:spring/dubbo-servicecomb.xml");
            context.start();
            System.in.read();
          } catch (Throwable e) {
            e.printStackTrace();
          }
        }
      }
      ```
    
  • Start Up using Spring Boot

In Spring Boot Component scan, add classpath*:spring/dubbo-servicecomb.xml.

    ```
    @SpringBootApplication
    @ImportResource({"classpath*:spring/dubbo-provider.xml", "classpath*:spring/dubbo-servicecomb.xml"})
    public class PriceApplication {
      public static void main(String[] args) throws Exception {
        try {
          SpringApplication.run(PriceApplication.class);
        } catch (Throwable e) {
          e.printStackTrace();
        }
      }
    }
    ``` 

In POM, add

    ```
    <dependency>
      <groupId>com.huaweicloud.dubbo-servicecomb</groupId>
      <artifactId>dubbo-servicecomb-spring-boot</artifactId>
    </dependency>
    ```
  • using service center

    In Spring configuration files, change zookeeper to service center.

      ```xml
      <dubbo:registry address="sc://127.0.0.1:30100"/>
      ```
    

    The address is ignored and configured in dubbo.properties.

  • In dubbo.properties configurations

    The configurations include microservice name, version and address of service center, config center.

      ```properties        
      dubbo.servicecomb.service.application=discovery
      dubbo.servicecomb.service.name=price-provider
      dubbo.servicecomb.service.version=1.0.0
      dubbo.servicecomb.service.environment=production
      #### END
      
      dubbo.servicecomb.registry.address=http://127.0.0.1:30100
      
      dubbo.servicecomb.config.address=http://127.0.0.1:30113
      ```
    
  • add governance configurations

dubbo.servicecomb.governance: {"providerInfos":[{"serviceName":"price-provider","schemaInfos":[{"schemaId":"com.huaweicloud.it.price.PriceService","parameters":{"timeout":5000}}]}]}

Using Cloud Service Engine

Change address to Cloud Service Engine address and configure HTTPS, AK/SK.

#### service center address ####
dubbo.servicecomb.registry.address=https://cse.cn-north-1.myhuaweicloud.com

#### config center address ####
dubbo.servicecomb.config.address=https://cse.cn-north-1.myhuaweicloud.com

#### enabled SSL  ####
dubbo.servicecomb.ssl.enabled=true

#### Configure AK/SK  ####
dubbo.servicecomb.credentials.enabled=true
dubbo.servicecomb.credentials.accessKey= Your access key
dubbo.servicecomb.credentials.secretKey= Your secret key
dubbo.servicecomb.credentials.project=cn-north-1

Configurations Reference

#### Microservices ####
# Application
dubbo.servicecomb.service.application=discovery
# Microservice Name
dubbo.servicecomb.service.name=price-provider
# Version, default is 1.0.0.0
dubbo.servicecomb.service.version=1.0.0
# Environment, default is Empty.  Options: development, testing, acceptance, production
# dubbo.servicecomb.service.environment=production
# Project 
# dubbo.servicecomb.service.project=
#### END

#### Microservice Instance ####
# Initial status. Options: UP, DOWN, STARTING, OUTOFSERVICE
# dubbo.servicecomb.instance.initialStatus=UP
#### END

#### service center address ####
dubbo.servicecomb.registry.address=http://127.0.0.1:30100

#### config center address ####
dubbo.servicecomb.config.address=http://127.0.0.1:30113

#### SSL options  ####
#dubbo.servicecomb.ssl.enabled=true
# ssl engine. Options JDK or OPENSSL
#dubbo.servicecomb.ssl.engine=
# ssl protocols, default to TLSv1.2
#dubbo.servicecomb.ssl.protocols=
# ssl ciphers, default to TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
#dubbo.servicecomb.ssl.ciphers=
#dubbo.servicecomb.ssl.authPeer=false
#dubbo.servicecomb.ssl.trustStore=
#dubbo.servicecomb.ssl.trustStoreType=
#dubbo.servicecomb.ssl.trustStoreValue=
#dubbo.servicecomb.ssl.keyStore=
#dubbo.servicecomb.ssl.keyStoreType=
#dubbo.servicecomb.ssl.keyStoreValue=
#dubbo.servicecomb.ssl.crl=
#dubbo.servicecomb.ssl.sslCustomClass=

#### AK/SK Options  ####
#dubbo.servicecomb.credentials.enabled=true
#dubbo.servicecomb.credentials.accessKey=
#dubbo.servicecomb.credentials.secretKey=
#dubbo.servicecomb.credentials.cipher=
#dubbo.servicecomb.credentials.project=cn-south-1

dubbo-servicecomb's People

Contributors

glovethu avatar jindongxia avatar liubao68 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.