All Products
Search
Document Center

Microservices Engine:Migrate service data from Consul to MSE Nacos

Last Updated:Feb 28, 2026

This guide describes how to use MSE Sync to synchronize all service data from a self-managed Consul instance to a Microservices Engine (MSE) Nacos instance, replace client dependencies, update application configurations, and verify the migration.

Migration stages

StageDescription
1. Configure MSE SyncStart MSE Sync and set it up with the source Consul instance and destination MSE Nacos instance to synchronize service data.
2. Replace client dependenciesReplace the Consul SDK with the Nacos SDK in application projects.
3. Update application configurationsPoint applications to the MSE Nacos instance instead of the Consul instance.
4. Repackage, deploy, and verifyRebuild applications and confirm that services register correctly with MSE Nacos.

Prerequisites

Before you begin, ensure that you have:

Step 1: Start MSE Sync and import configurations

Start MSE Sync and import the source and destination instance configurations by using a YAML configuration file.

Create the configuration file

Create a YAML file with the following content:

clusters:
  - clusterName: dst
    connectKeyList:
      - {nacos.endpoint}:8848
    clusterType: NACOS
  - clusterName: src
    connectKeyList:
      - {consul.endpoint}:8500
    clusterType: CONSUL
tasks:
  - source: src
    destination: dst

Replace the placeholder values:

PlaceholderReplace withExample
{nacos.endpoint}The endpoint of the MSE Nacos instancemse-zzzzz-.nacos-ans.mse.aliyuncs.com
{consul.endpoint}The IP address of the Consul instance10.0.0.1

Import the configuration file

Start MSE Sync and import the configuration file. After the import, MSE Sync periodically scans for new services in both the source and destination instances and automatically creates synchronization tasks.

Note

MSE Sync periodically scans the Consul instance and synchronizes updates. To adjust the scan interval, set the consul.refresh.interval parameter. The default value is 5 seconds.

Verify synchronization

View the number of completed synchronization tasks in MSE Sync. Confirm that all service data has been synchronized from Consul to the MSE Nacos instance.

Step 2: Replace client dependencies

Replace the Consul SDK with the Nacos SDK in application projects.

For Spring Cloud applications, update the Maven dependency as follows:

groupIdartifactId
Before (Consul)org.springframework.cloudspring-cloud-starter-consul-discovery
After (Nacos)com.alibaba.cloudspring-cloud-starter-alibaba-nacos-discovery

Remove the Consul dependency:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>

Add the Nacos dependency:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>

Use a version of spring-cloud-starter-alibaba-nacos-discovery compatible with the Spring Cloud version in the project.

Step 3: Update application configurations

Replace the Consul configuration block in the application configuration file with the Nacos configuration block to set the MSE Nacos instance as the service registry.

Example configuration (application.yml):

server:
  port: 9999

spring:
  application:
    name: sp-provider
  cloud:
    nacos:
      discovery:
        server-addr: mse-xxxxx-nacos-ans.mse.aliyuncs.com:8848

The following commented-out block shows the original Consul configuration for reference:

#    consul:
#      host: 11.164.x.x
#      port: 8500
#      config:
#        enabled: false
#      discovery:
#        health-check-path: /health

Step 4: Repackage and deploy applications

Rebuild application packages with the updated dependencies and configurations. Deploy the new packages to the environment.

Step 5: Verify the migration

After deployment, complete the following checks:

  1. Confirm that all applications start without errors.

  2. Test service-to-service calls to verify that service discovery works correctly.

  3. Open the MSE console and check that all applications are registered with the MSE Nacos instance.

FAQ

Service data in Consul is not synchronized to MSE Nacos

Check whether the service in Consul passes its health check. MSE Sync synchronizes only data of healthy instances. Unhealthy or failing services are excluded from synchronization.

References

For more information about MSE Sync and other supported instance types, see Migration solution based on MSE Sync.