All Products
Search
Document Center

Enterprise Distributed Application Service:Smoothly migrate Dubbo applications to EDAS

Last Updated:Jul 08, 2024

This topic describes how to smoothly migrate the Dubbo applications on Alibaba Cloud to Enterprise Distributed Application Service (EDAS) and register and discover services. If your Dubbo applications are not deployed on Alibaba Cloud, submit a ticket or contact EDAS technical support to obtain a complete solution for migration to EDAS.

Benefits of migration to EDAS

  • EDAS provides features for application deployment, such as flexible configuration of startup parameters, process visualization, graceful service connection and disconnection, and phased release. This allows you to configure, query, and control application release processes.

  • EDAS provides the service discovery and configuration management features in its commercial release. This saves you from maintaining the middleware, such as Eureka, ZooKeeper, or Consul.

  • The EDAS console supports centralized service governance. This allows you to query the details of released and consumed services.

  • EDAS provides automatic scaling. This allows you to dynamically scale your applications in or out based on traffic peaks and valleys.

  • In addition to instance information query, EDAS also provides advanced monitoring features, such as microservices trace query, query of the system call topology, and slow SQL query.

  • EDAS provides the throttling and degradation features to ensure the high availability of your applications.

  • EDAS provides the end-to-end phased release feature for small-scale validation when you iterate and update your applications.

Smooth migration

If your Dubbo applications are deployed in the production environment and are running as expected, you can perform smooth migration to migrate the applications to EDAS and use all EDAS features. Smooth migration ensures service continuity.

Note

If your Dubbo applications are not deployed in the production environment or migration with downtime is acceptable, you can directly deploy the application to EDAS after you develop them in your on-premises environment. For more information, see Get started with EDAS.

Migration process

  1. Required. Migrate applications.

    Applications to be migrated are typically stateless and can be migrated first. This topic focuses on how to migrate applications.

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

    After the application migration is complete, you need to migrate the SLB instance or modify the domain name configuration.

    • SLB

      • If an SLB instance is used before migration, you can reuse the SLB instance after migration.Overview.

      • If no SLB instance is used before migration, we recommend that you create and bind an SLB instance to the entry application, such as API Gateway in the preceding figure, after migration.

    • Domain name

      • The domain name configuration can be retained if the SLB instance can be reused after migration.

      • To create and bind an SLB instance to migrated applications, you must add this SLB instance configuration to the domain name configuration and delete the original SLB instance. For more information, see Change DNS servers for a domain name.

  3. Optional: Optional. Migrate storage and message queues.

    • Applications deployed on Alibaba Cloud use Alibaba Cloud services, such as ApsaraDB RDS and Message Queue. 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 technical support to obtain a complete solution for migration to EDAS.

This topic describes how to migrate applications. EDAS provides a demo to show you how to smoothly migrate applications. You can download this demo and run the demo by referring to Readme.

Migration methods

You can migrate applications by using registry switching or dual registration and dual subscription. The two methods allow you to migrate applications without service downtime.

  • Registry switching

    Use Dubbo to switch the original service registry to EDAS Config Server, develop a new set of applications, and then deploy them to EDAS. Then, use Server Load Balancer (SLB) and configure domain names to switch traffic.

    If you use the registry switching method, you can skip the remaining content of this topic. You can use Spring Boot to develop Dubbo microservices applications. For more information, see Use Spring Boot to develop a Dubbo microservices application.

  • Dual registration and dual subscription

    Access the original service registry and the EDAS service registry when applications are being migrated to enable mutual calling between migrated applications and non-migrated applications.

    • Migrated applications and non-migrated applications can discover and call each other. This ensures service continuity.

    • You need to only add dependencies and modify a line of code to implement dual registration and dual subscription.

    • You can view the details of consumer service calls and view the migration progress in real time.

    • You can dynamically modify the policies of service registration and subscription without the need to repeatedly restart applications. You need to restart applications only once in the migration process.

Migrate the first application

  1. Select the first application to migrate.

    We recommend that you start migration from the underlying provider. You can randomly select an application to migrate if the trace is complex and difficult to analyze. Migrate the selected application by performing the subsequent steps.

  2. Add dependencies to the application and modify its configurations. You must modify the application configurations if you use the dual registration and dual subscription method.

    Add dependencies to the application and modify its configurations before the application is migrated 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

      If the application is not a Spring Boot application, configure the application in dubbo.properties or in the Spring profile.

      • edas-migration://30.5.124.15:9999

        The header of the registry address. You do not need to modify the header if the application is registered with multiple service 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

        The address of the service registry with which the application is registered. By default, the application is registered with multiple service registries. Therefore, 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 that is marked by using the ZooKeeper address 172.31.20.219. `

      • reference-registry

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

      • config-address

        The dynamically pushed address. To implement dynamic push in your on-premises environment, download Nacos. EDAS converts this address.

    3. Complete other modifications.

      If the Spring application is not developed in Spring Boot, add com.alibaba.edas.dubbo.migration.controller.EdasDubboRegistryRest to the scan path.

  3. Verify the result in your on-premises environment.

    Use dynamic configuration for one-time modification.

    1. Make preparations.

    2. Check whether the service is registered.

      • Log on to the lightweight configuration center to view the service in the service provider list.

      • Log on to ZooKeeper to view the 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.

      • DataId: Set this parameter to dubbo.registry.config.

      • Group: Set this parameter to the Dubbo application name that is specified in applicationName, such as dubbo-migration-demo-server. The application name must be unique because the service registration information is configured at the application level.

      • Configuration Content: The configuration content can be at the application level or the instance IP address level. If multiple network interface controllers (NICs) are used, an error may occur at the instance IP address level.

        • Application level

          dubbo.reference.registry=edas://127.0.0.1:8080   ## The service registry with which the service is registered
          dubbo.service.registry=edas://127.0.0.1:8080,zookeeper:127.0.0.1:2181 ## The service 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 you validate a cluster, you can check whether the configurations at the instance IP address level and those at the application level take effect in sequence.

    4. Check whether the 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 (ACK) cluster based on your business requirements. You can use the EDAS console or the related tool to deploy the application. For more information, see Overview of Application Hosting (K8s) and Overview of Application Hosting (ECS).

    • We recommend that you reuse an existing ECS instance by importing the instance to EDAS. This saves costs. For more information, see Create an ECS cluster in the EDAS console.

      Important

      If you are prompted to perform conversion when you import the ECS instance, back up important data before you proceed with your operation.

    • If you do not reuse an existing ECS instance, you must create resources such as an ECS instance and a cluster in the existing virtual private cloud (VPC). This makes the network between applications before and after migration connected so that applications can be migrated. For more information, see Overview.

    • Configure an IP address whitelist for the new ECS instance in products such as a database, a cache, and a message queue. This ensures that the ECS instance can access these third-party components as expected.

  5. Verify the result.

    1. Check whether your service runs as expected.

    2. View the monitoring data of service subscription.

      If Spring Boot Actuator is enabled for the application, you can access Actuator to view the information about RibbonServerList of each application-subscribed service. You can access Actuator by using the following URLs:

      • Spring Boot 1.x: http://ip:port/dubboRegistry

      • Spring Boot 2.x: http://ip:port/actuator/dubboRegistry

      • dubbo.orig.**: the service registry information that is configured in the application.

      • dubbo.effective.**: the service registry information that takes effect in the application.

Migrate all the other applications

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

Delete migration configurations

After the migration is complete, delete the original service registry configurations and the edas-dubbo-migration-bom dependency that is used during the migration.

Modify the registry address by deleting the ZooKeeper configurations. This ensures that consumers subscribe only from EDAS and that providers provide subscriptions only in EDAS. You can modify the registry address by using the following methods:

  • Method 1: dynamic configuration

    For more information, see Verify the result in your on-premises environment.

  • Method 2: manual modification

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

    dubbo.registry.address = edas-migration://30.5.XXX.XXX: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 the applications.

    Note

    If you no longer require ZooKeeper, delete zookeeper://172.31.20.219:2181 from the service registry configurations after the migration.

    dubbo.registry.address = edas://127.0.0.1:8080                        

Over the long term, ZooKeeper does not have an impact on service stability, but it does increase the complexity and error rate of using service registries in Dubbo. We recommend that you delete the ZooKeeper configurations after the migration and restart the applications in batches during off-peak hours.