This topic describes how to smoothly migrate Dubbo applications in Alibaba Cloud to Enterprise Distributed Application Service (EDAS) and register and discover services. If your Dubbo applications have not been deployed to Alibaba Cloud, open a ticket or contact EDAS Customer Services to obtain a complete solution for migrating to EDAS.

Benefits of migrating to EDAS

  • EDAS provides functions for application deployment, including flexible configuration of startup parameters, process visualization, graceful connection and disconnection for services, and batch publishing. This allows you to configure, query, and control application publishing processes.
  • EDAS provides the service discovery and configuration management functions in its commercial release, removing the need to maintain middleware such as Eureka, ZooKeeper, and Consul.
  • The EDAS console supports centralized service administration, allowing you to query the details of published and consumed services.
  • EDAS allows you to dynamically scale your applications based on traffic peaks and valleys.
  • In addition to instance information query, EDAS also provides advanced monitoring functions, such as microservice trace query, system call topology query, and slow SQL query.
  • EDAS provides the throttling and degradation functions to ensure the high availability of your applications.
  • EDAS provides the end-to-end phased release function for small-scale validation when you iterate and upgrade your applications.

What is smooth migration?

You can ensure service continuity through smooth migration when you migrate your Dubbo applications that are in the normal running state from the production environment to EDAS for access to all functions provided by EDAS.

Note If your Dubbo applications are not deployed in the production environment or you do not mind downtime migration, you can locally develop applications and then deploy them to EDAS. For more information, see the t1838891.dita#task_2320387.

Migration process

The following figure shows a typical application architecture, in which migration is divided into three steps.

  1. (Required) Migrate applications

    Applications to be migrated are typically stateless and can be migrated first. Migrating applications is our focus in this topic.

  2. (Optional) Migrate the SLB instance or modify the domain name configuration

    After the application migration is complete, you need to migrate the Server Load Balancer (SLB) instance or modify the domain name configuration.

    • SLB
      • You can reuse the existing SLB instance after migration.
      • If no SLB instance is used before migration, we recommend that you create and bind an SLB instance to the ingress application (such as API Gateway in the preceding figure) after migration.
      • We recommend that you enable dual registration and dual subscription when migrating applications to reduce the costs of using Elastic Compute Service (ECS). If the existing ECS instance cannot be reused due to reasons such as occupation of the ECS port, you need to adopt the registry switching solution and add new ECS instances. After application migration is complete, reuse the existing SLB instance or create and bind an SLB instance as needed.
    • Domains
      • The domain name configuration can be retained if the SLB instance can be reused after migration.
      • To create and bind an SLB instance to the applications after migration, you need to add this SLB instance configuration to the domain name configuration and delete the old SLB instance. For more information, see Modify DNS.
  3. (Optional) Migrate storage and message queues
    • Applications deployed on Alibaba Cloud use Alibaba Cloud products such as ApsaraDB for RDS and Message Queue (MQ). Therefore, you do not need to migrate storage and message queues along with applications.
    • If your applications are not deployed on Alibaba Cloud, submit a ticket or contact EDAS Customer Services to obtain a complete solution for migrating to EDAS.

This topic describes how to migrate applications. You can smoothly migrate applications by using this demo and running a migration example based on Readme.

Migration solution

You can migrate applications by using two methods: (1) registry switching; (2) dual registration and dual subscription. The two methods allow you to migrate applications during runtime without service discontinuity.

  • Registry switching

    Switch the old service registry to EDAS Config Server through Dubbo, develop a new set of applications and deploy them to EDAS, and switch traffic through Server Load Balancer (SLB) and domain name configuration.

    If you use registry switching, see t1838891.dita#task_2320387 to develop applications. You can skip the subsequent content of this topic.

  • Dual registration and dual subscription

    Access the old service registry and the EDAS service registry when migrating applications to enable mutual calling between migrated applications and non-migrated applications.

    The following figure shows the architecture of smooth migration through dual registration and dual subscription.

    • Migrated applications and non-migrated applications can discover and call each other, ensuring service continuity.
    • You simply need to add dependencies and modify a line of code.
    • You can view the details of a consumer service call list and the migration progress in real time.
    • You can dynamically modify the policies of service registration and subscription without restarting applications. Applications are restarted only once during the migration process.

Migrate the first application

  1. Select the application to be migrated first.
    We recommend that you start migration from the underlying provider. You can select any application to be migrated first if the trace is complex and difficult to analyze. Migrate the selected application as follows.
  2. Add dependencies to the application and modify its configuration (applicable to dual registration and dual subscription).
    Add dependencies to the application and modify its configuration before hosting it to EDAS.
    1. Add the edas-dubbo-migration-bom dependency 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>                                
    2. Add the registry address to application.properties.
      dubbo.registry.address = edas-migration://30.5.124.15:9999? service-registry=edas://127.0.0.1:8080,zookeeper://172.31.20.219:2181&reference-registry=zookeeper://172.31.20.219:2181&config-address=127.0.0.1:8848             
      Note For a non-Spring Boot application, configure it in dubbo.properties or in the Spring profile.
      • edas-migration://30.5.124.15:9999

        You do not need to modify the header if the application is registered to multiple registries. If the log level is WARN or lower, a WARN log may be thrown during startup because Dubbo verifies the IP address and port. The log can be ignored.

      • service-registry

        It indicates the address of the registry to which the application is registered. By default, the application is registered to multiple registries, so multiple registry addresses are written. Each registry address is in the standard format of a Dubbo registry address. Separate multiple registry addresses with commas (,). Enter the actual ZooKeeper address and port number for the instance marked with the ZooKeeper address 172.31.20.219. `

      • reference-registry

        It indicates the registry address for service subscription. You can register with multiple registries or with the old registry first. Each registry address is in the standard format of a Dubbo registry address. Separate multiple registry addresses with commas (,).

      • config-address

        It indicates the dynamically pushed address. To implement dynamic push locally, download Nacos. EDAS converts this address.

    3. Complete other modifications.
      For a Spring application not based on Spring Boot, add com.alibaba.edas.dubbo.migration.controller.EdasDubboRegistryRest to the scan path.
  3. Locally verify the result.
    Use dynamic configuration for one-time modification.
    1. Complete preparations.
    2. Check whether the service is registered.
      • Log on to the lightweight configuration center console to view the service in the service provider list.
      • Log on to ZooKeeper to view information about service registration and consumption.
    3. (Optional) Log on to Nacos to configure the service registration information.
      Note Skip this step if dynamic configuration is not required.
      • Set DataId to dubbo.registry.config.
      • Group corresponds to the name of the Dubbo application, which is indicated by applicationName, such as dubbo-migration-demo-server. The application name must be unique because configuration is performed at the application level.
      • Value can be at the application level or the instance IP address level. Pay special attention when more than one network interface controller (NIC) is used.
        • Application level
          dubbo.reference.registry=edas://127.0.0.1:8080   ##The registry to which the service is registered
          dubbo.service.registry=edas://127.0.0.1:8080,zookeeper:127.0.0.1:2181   ##The registry for service subscription                                                
        • Instance IP address level
          169.254.15.86.dubbo.reference.registry=edas://127.0.0.1:8080,zookeeper:127.0.0.1:2181
          169.254.15.86.dubbo.service.registry=edas://127.0.0.1:8080                                                

        When validating the cluster, you can check whether the configuration at the instance IP address level and that at the application level take effect in sequence.

    4. Check whether application call is normal and check the registration and subscription relationship of the registry.
      • Spring Boot 1.x: http://ip:port/dubboRegistry
      • Spring Boot 2.x: http://ip:port/actuator/dubboRegistry
  4. Deploy the modified application to EDAS.
    You can deploy the application to an Elastic Compute Service (ECS) cluster or a Container Service for Kubernetes cluster as needed, by using the EDAS console or related tool. For more information, see t1838945.dita#concept_2038298.
    • We recommend that you reuse the existing ECS instance by importing it to EDAS to save costs. For more information, see t1839044.dita#topic2215. Back up important data if you are prompted to perform conversion when importing the ECS instance.
    • If you do not reuse the existing ECS instance, you must create an ECS instance, a cluster, and other resources in the existing Virtual Private Cloud (VPC) to ensure network interoperability between applications before and after migration. For more information, see t1838888.dita#Task87742.
    • Configure an IP address whitelist for the new ECS instance in database, cache, and message queue products to ensure normal access to the application-dependent third-party components.
  5. Verify the result.
    1. Check whether the service is normal.
    2. View service subscription monitoring data.
      If Spring Boot Actuator is enabled for the application, you can access Actuator to view information about RibbonServerList of each application-subscribed service. You can access Actuator in the following URLs:
      • Spring Boot 1.x: http://ip:port/dubboRegistry
      • Spring Boot 2.x: http://ip:port/actuator/dubboRegistry
      • dubbo.orig. ** indicates the registry information configured in the application.
      • dubbo.effective. ** indicates the effective registry information.

Migrate all other applications

Migrate the other applications to EDAS by repeating the procedure of migrating the first application.

Clear the migration configuration

After migration, delete the old registry configuration and the edas-dubbo-migration-bom dependency used by migration.

Modify the registry address by deleting the ZooKeeper configuration to ensure that consumers subscribe only from EDAS and that providers offer subscriptions only in EDAS. You can modify the registry address by using either of the following methods:

  • Method 1: dynamic configuration

    For more information, see Locally verify the results.

  • Method 2: manual modification

    Change the registry address to the address of EDAS Config Server after all applications are modified.

    dubbo.registry.address = edas-migration://30.5.124.15:9999? service-registry=edas://127.0.0.1:8080,zookeeper://172.31.20.219:2181&reference-registry=edas://127.0.0.1:8080&config-address=127.0.0.1:8848                   

    Change the value of reference-registry from zookeeper://172.31.20.219:2181 to edas://127.0.0.1:8080. Then, deploy applications.

    Note Delete zookeeper://172.31.20.219:2181 from the registry configuration if ZooKeeper is no longer required after applications are migrated. The final registry address is as follows.
    dubbo.registry.address = edas://127.0.0.1:8080                        

From the long-term perspective, ZooKeeper has no impact on service stability but increases the complexity and error rate of using registries in Dubbo. We recommend that you clear the ZooKeeper configuration after migration and restart applications in batches during idle hours.