All Products
Search
Document Center

Microservices Engine:Migrate from Consul to MSE Nacos

Last Updated:Jun 04, 2026

Migrate service data from a self-managed Consul instance to MSE Nacos by synchronizing services with MSE Sync, replacing Consul SDK dependencies with the Nacos SDK, and updating application configurations.

Migration stages

Stage Description
1. Configure MSE Sync Set up MSE Sync to synchronize service data between the source Consul and destination Nacos instances.
2. Replace client dependencies Replace the Consul SDK with the Nacos SDK in application projects.
3. Update application configurations Point applications to the MSE Nacos instance instead of the Consul instance.
4. Repackage, deploy, and verify Rebuild applications and confirm that services register correctly with MSE Nacos.

Prerequisites

Before you begin:

Step 1: Configure MSE Sync

Configure MSE Sync with a YAML file that specifies the source Consul and destination Nacos instances.

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:

Placeholder Replace with Example
{nacos.endpoint} MSE Nacos instance endpoint mse-zzzzz-.nacos-ans.mse.aliyuncs.com
{consul.endpoint} Consul instance IP address 10.0.0.1

Import the configuration file

Start MSE Sync and import the configuration file. MSE Sync then periodically scans both instances and automatically creates synchronization tasks for new services.

Note

The default scan interval is 5 seconds. To change it, set consul.refresh.interval.

Verify synchronization

In MSE Sync, verify that all synchronization tasks are complete and service data from Consul appears in the 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:

groupId artifactId
Before (Consul) org.springframework.cloud spring-cloud-starter-consul-discovery
After (Nacos) com.alibaba.cloud spring-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>

Choose a spring-cloud-starter-alibaba-nacos-discovery version compatible with your Spring Cloud version.

Step 3: Update application configurations

In the application configuration file, replace the Consul block with the Nacos service registry endpoint.

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

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 and deploy applications with the updated dependencies and configurations.

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 confirm service discovery works.

  3. In the MSE console, verify that all applications are registered with the Nacos instance.

FAQ

Service data in Consul is not synchronized to MSE Nacos

Verify that the service passes its health check in Consul. MSE Sync only synchronizes healthy instances.

References

Migration solution based on MSE Sync covers additional details and supported instance types.