Migrate Dubbo applications to SAE
If your Dubbo application is already deployed on Alibaba Cloud, you can migrate it to Serverless App Engine (SAE). This topic explains how to smoothly migrate your application to SAE.
Step 1: Migrate the first application
This topic demonstrates the migration process by using a demo application. To download the demo application, see Demo.
-
Prioritize applications for migration.
We recommend that you start with the lowest-level provider in the call chain. If the call chain is too complex to analyze, you can start with any application.
-
Add a dependency and modify configurations in the application.
NoteThis migration uses the dual-registration and dual-subscription strategy.
-
Add the
edas-dubbo-migration-bomdependency to the pom.xml file.<dependency> <groupId>com.alibaba.edas</groupId> <artifactId>edas-dubbo-migration-bom</artifactId> <version>2.6.5.1</version> <type>pom</type> </dependency> -
Add the IP address of the SAE service registry to the application.properties file.
dubbo.registry.address = edas-migration://192.168.XX.XX:9999?service-registry=edas://127.0.XX.XX:8080,zookeeper://192.168.XX.XX:2181&reference-registry=zookeeper://192.168.XX.XX:2181&config-address=127.0.XX.XX:8848ImportantFor non-Spring Boot applications, configure this in the dubbo.properties file or the corresponding Spring configuration file.
Parameter
Description
edas-migration://192.168.XX.XX:9999
You do not need to modify the header for multiple service registries. During startup, Dubbo validates the IP address and port. If your log level is set to WARN or lower, a WARN log message may appear, which you can ignore.
service-registry
The address of the service registry for service registration. You can specify multiple service registry addresses, separated by a comma (
,). Each address must be in the standard Dubbo registry format. In the example,192.168.XX.XXis the ZooKeeper address. Replace it with your actual ZooKeeper IP address and port.reference-registry
The address of the service registry for service subscription. This parameter supports multiple registries or subscription to the original service registry used before the migration.
config-address
The address for pushing dynamic configurations.
-
Other modifications.
For Spring applications that do not use Spring Boot, add
com.alibaba.edas.dubbo.migration.controller.EdasDubboRegistryRestto your scan path.
-
-
Local verification.
This section provides an example using dynamic configuration.
-
Before you start the verification, complete the following steps:
-
Verify that the service is registered.
-
Log on to the lightweight configuration and registration center and check for the service in the Provider List.
-
Log on to ZooKeeper and view the service registration and consumption information.
-
-
Optional: Log on to Nacos and configure service registration information.
NoteIf you do not need dynamic configuration, you can skip this step.
Parameter
Description
DataId
Set this parameter to dubbo.registry.config.
Group
Set this parameter to the name of the Dubbo application, which is specified by applicationName, such as dubbo-migration-demo-server. The configuration is at the application level, so the application name must be unique.
Configuration content
-
Application level
dubbo.reference.registry=edas://127.0.XX.XX:8080 # The address of the service registry for service subscription. dubbo.service.registry=edas://127.0.XX.XX:8080,zookeeper:127.0.XX.XX:2181 # The address of the service registry for service registration. -
Instance IP address level
192.168.XX.XX.dubbo.reference.registry=edas://127.0.XX.XX:8080,zookeeper:127.0.XX.XX:2181 192.168.XX.XX.dubbo.service.registry=edas://127.0.XX.XX:8080
When verifying a cluster, we recommend first verifying at the instance IP address level and then at the application level.
-
-
Verify that application calls function correctly after migration, and check the registration and subscription status in the service registry.
-
Spring Boot 1.x: http://ip:port/dubboRegistry
-
Spring Boot 2.x: http://ip:port/actuator/dubboRegistry
The following is an example of the service registry configuration information that is returned when you access one of the preceding endpoints:
{ "dubbo.effective.reference.registry": [ "edas://127.0.xxx:8080" ], "dubbo.orig.reference.registry": [ "zookeeper://127.0.xxx:2181" ], "dubbo.orig.service.registry": [ "edas://127.0.xxx:8080", "zookeeper://127.0.xxx:2181" ], "dubbo.effective.service.registry": [ "edas://127.0.xxx:8080", "zookeeper://127.0.xxx:2181" ] } -
-
-
Deploy the application to SAE.
Deploy the application to SAE as needed. For more information, see Application deployment.
-
Verify the results.
-
Verify that your business services function correctly.
-
Check service subscription monitoring.
If Spring Boot Actuator monitoring is enabled for your application, access the Actuator endpoints to view the RibbonServerList information for subscribed services:
-
Spring Boot 1.x: http://ip:port/dubboRegistry
-
Spring Boot 2.x: http://ip:port/actuator/dubboRegistry
{ "dubbo.effective.reference.registry": [ "edas://127.0.xxx:8080" ], "dubbo.orig.reference.registry": [ "zookeeper://127.0.xxx:2181" ], "dubbo.orig.service.registry": [ "edas://127.0.xxx:8080", "zookeeper://127.0.xxx:2181" ], "dubbo.effective.service.registry": [ "edas://127.0.xxx:8080", "zookeeper://127.0.xxx:2181" ] }Parameter descriptions:
-
dubbo.orig.**: The service registry information configured in the application. -
dubbo.effective.**: The effective service registry information.
-
-
Step 2: Migrate all remaining applications
Sequentially migrate all other applications to SAE. For more information, see Step 1: Migrate the first application.
Step 3: Clean up migration configuration
After the migration is complete, delete the original service registry configuration and the migration-only dependency edas-dubbo-migration-bom.
Update the service registry addresses to ensure consumers and providers subscribe only from SAE. This involves removing the ZooKeeper configuration. You can do this in one of the following ways:
-
Method 1: Use dynamic configuration. For more information, see the local verification section.
-
Method 2: Modify the configuration manually.
After you update all applications, change the service registry address and set the subscription address to SAE Config Server.
dubbo.registry.address = edas-migration://192.168.XX.XX:9999?service-registry=edas://127.0.XX.XX:8080,zookeeper://192.168.XX.XX:2181&reference-registry=edas://127.0.XX.XX:8080&config-address=127.0.XX.XX:8848Change the value of
reference-registryfromzookeeper://192.168.XX.XX:2181toedas://127.0.XX.XX:8080and then deploy the application.NoteAfter the migration is complete, if you no longer use
ZooKeeper, removezookeeper://192.168.XX.XX:2181from the service registry configuration.While continued use of the old ZooKeeper does not affect business stability, it complicates Dubbo's interaction with the service registry and may increase the error rate. We recommend removing the old ZooKeeper configuration promptly after the migration is complete, and restarting the applications in batches during off-peak hours. The final example address is as follows:
dubbo.registry.address = edas://127.0.XX.XX:8080