NOTICE: This project is no longer in maintain. Please use it very carefully for your product.
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.
Before reading the next contents, check the supported versions in different branch.
Branch | Latest Version | Dubbo Base Version | Supported Dubbo Suggestions |
---|---|---|---|
master | 2.0.0-2.7.x | 2.7.8 | 2.7.x,Suggested upgrade to 2.7.8 or later |
2.6.x | 2.0.0-2.6.x | 2.6.9 | 2.6.x,Suggested upgrade to 2.6.9 or later |
Dubbo Microservice Concepts
Dubbo-ServiceComb Concepts
In the following chapters we use Dubbo-ServiceComb Concepts.
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
Service Based Discovery
, so that different version can be manged together. And
can inter-operate with other microservice framework.Drawbacks
Dubbo Admin
to change governance properties, while Dubbo ServiceComb cannot.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-solution-spring-boot</artifactId>
</dependency>
```
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();
}
}
}
```
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
or applicion.yaml
configurations
The configurations include microservice name, version and address of service center, config center.
```yaml
PAAS_CSE_SC_ENDPOINT: http://127.0.0.1:30100
PAAS_CSE_CC_ENDPOINT: http://127.0.0.1:30113
dubbo:
servicecomb:
service:
application: basic-application
name: price-provider
version: 1.0.0
# environmen: production # options: development, testing, acceptance, production
# project:
# instance:
# initialStatus: UP # options: UP, DOWN, STARTING, OUTOFSERVICE
registry:
address: ${PAAS_CSE_SC_ENDPOINT}
config:
address: ${PAAS_CSE_CC_ENDPOINT}
```
add governance configurations
dubbo:
servicecomb:
governance: {"providerInfos":[{"serviceName":"price-provider","schemaInfos":[{"schemaId":"com.huaweicloud.it.price.PriceService","parameters":{"timeout":5000}}]}]}
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
#### 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