If your Spring Cloud cluster (including multiple applications) is deployed on Alibaba Cloud, you can smoothly migrate the cluster and all its applications to Enterprise Distributed Application Service (EDAS) and implement basic service registration and discovery based on the instructions provided by this topic. If your Spring Cloud cluster has 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 Spring Cloud cluster in the normal running state from the production environment to EDAS for access to all functions provided by EDAS.
Migration process
The following figure shows a typical application architecture, in which migration is divided into three steps.
- (Required) Migrate applications
Applications to be migrated are typically stateless and can be migrated first. Migrating applications is our focus in this topic.
- (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. You can select a policy for binding an SLB instance as needed. For more information, see Overview.
- 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.
- 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 need to add this SLB instance configuration to the domain name configuration and delete the old SLB instance. For more information, see Change DNS servers for a domain name.
- SLB
- (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, open 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 Nacos through Spring Cloud Alibaba. Develop applications and deploy them to EDAS, and switch traffic through SLB and domain name configuration.
If you use the registry switching method, you can develop applications by following the instructions in Host Spring Cloud applications to EDAS.
- 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
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-sc-migration-starter
dependency used by migration, and restart applications in batches during idle hours.
edas-sc-migration-starter
does not affect service stability but it limits the load balancing effect of Ribbon.
We recommend that it be cleared after migration.
Dynamically adjust service registries and service subscription policies
You can dynamically adjust service registries and service subscriptions during migration by using the configuration management function of EDAS.
- Dynamically adjust the service subscription policy
The default subscription policy is to subscribe from all registries and aggregate data.
You can choose to subscribe data from specific registries by modifying the
spring.cloud.edas.migration.subscribes
property through the configuration management function of EDAS.spring.cloud.edas.migration.subscribes=nacos,eureka # Subscribes to services from Eureka and Nacos. spring.cloud.edas.migration.subscribes=nacos # Subscribes to services only from Nacos.
- Dynamically adjust service registries
The default registration policy is to register with all registries.
You can adjust service registries through the configuration management function of EDAS.
Specify the registry you want to disable through the
spring.cloud.edas.migration.registry.excludes
property.spring.cloud.edas.migration.registry.excludes= #The default value is Null, which indicates registration with all service registries. spring.cloud.edas.migration.registry.excludes=eureka #Disables registration with Eureka. spring.cloud.edas.migration.registry.excludes=nacos,eureka #Disables registration with Nacos and Eureka.
To dynamically modify the registries to which an application is registered when running, you can use the Spring Cloud configuration management function to modify the preceding property at runtime.
Migration help
If an exception occurs during the migration process, join DingTalk group for help.