All Products
Search
Document Center

Microservices Engine:Migrate Dubbo applications from a self-managed Nacos registry to an MSE Nacos registry

Last Updated:Aug 06, 2024

Microservices Engine (MSE) provides solutions such as the migration solution based on the MSE Sync migration tool to smoothly migrate data from a self-managed Nacos registry to an MSE Nacos registry. This minimizes the negative impact on online services. Compared with self-managed Nacos registries, MSE Nacos registries provide advantages such as higher performance and capacity, more service discovery protocols, more convenient O&M management, and more flexible extensibility. MSE Nacos registries can meet the requirements of different business scenarios. This topic describes how to migrate Dubbo applications from a self-managed Nacos registry to an MSE Nacos registry.

Prerequisites

Limits

  • If the MSE Sync tool breaks down, the synchronization service is interrupted. Therefore, we recommend that you deploy the MSE Sync tool on at least two nodes. After the migration process starts, you must complete the migration at the earliest opportunity.

  • The networks among the self-managed Nacos registry, MSE Sync, and MSE Nacos registry are interconnected.

  • We recommend that you use the Nacos 2.x client. If you use the Nacos 1.x client, we recommend that you upgrade the client.

Migration procedure

The following figure shows the deployment architecture of the migration.

image

Step 1: Create a migration task

  1. In the left-side navigation pane of the MSE Sync tool, click Cluster Configuration. Then, click New Cluster. In the New Cluster dialog box, add the information about the source Nacos registry, and click OK.

    Parameter

    Description

    Cluster Name

    Enter a name of the registry.

    Cluster Type

    Select NACOS.

    NamespaceID

    Enter the ID of the namespace for service synchronization.

    username

    If Nacos authentication is enabled, enter the username and password.

    password

    AK

    The AccessKey ID.

    SK

    The AccessKey secret.

    Connect IP

    Enter one or more combinations of an IP address and port number of the Nacos registry. Each combination occupies one line. The default port number is 8848.

    If the source registry uses a Server Load Balancer (SLB) instance for load balancing, enter the IP address and port number of the SLB instance.

    c1

  2. Click New Cluster again to add the information about the destination Nacos registry.

    Parameter

    Description

    Cluster Name

    Enter a name of the registry.

    Cluster Type

    Select NACOS.

    NamespaceID

    Enter the ID of the namespace for service synchronization.

    username

    If Nacos authentication is enabled, enter the username and password.

    password

    AK

    The AccessKey ID.

    SK

    The AccessKey secret.

    Connect IP

    Enter one or more combinations of an endpoint and service port number of the MSE Nacos registry. Example: mse-8b7de****-p.zk.mse.aliyuncs.com:8848.

    c2

  3. In the left-side navigation pane, click Synchronization Tasks. On the Service Synchronization page, click New Sync to add the Dubbo service that you want to migrate.

    • Sync Mode: Select Bidirection. In this mode, service data can be synchronized between the source and destination Nacos registries if the service data on the source or destination Nacos registry updates.

    • Sync Type: Select Service. MSE Sync automatically displays all applications that are registered with the source registry. You can select the applications based on your business requirements.

    e

  4. Click OK.

    The synchronized application names are displayed on the Service Synchronization page of the MSE Sync tool.c4

Step 2: Verify the synchronization result

  1. Log on to the MSE console, and select a region in the top navigation bar.

  2. In the left-side navigation pane, choose Microservices Registry > Instances.

  3. On the Instances page, click the name of the instance.

  4. In the left-side navigation pane, choose Service Management > Services to check whether the service data is synchronized.

Step 3: Migrate the Dubbo clients

  1. Change the endpoints of the Dubbo clients.

    Find the XML configuration file of a Dubbo client and replace the endpoint of the self-managed Nacos registry in dubbo:registry address with the endpoint of the MSE Nacos registry. The following code provides an example.

    Before the change:

     <dubbo:registry address="nacos://127.0.0.1:8848"/>

    After the change:

     <dubbo:registry address="nacos://mse-********-p.nacos-ans.mse.aliyuncs.com:8848"/>
  2. Restart the Dubbo clients to connect the clients to the MSE Nacos registry.

    Note

    To ensure service continuity, we recommend that you restart Dubbo clients in batches. After the restart is complete, check whether all Dubbo clients are connected to the MSE Nacos registry.

Step 4: Shut down the self-managed Nacos registry

  1. Shut down the self-managed Nacos registry.

  2. Disable the MSE Sync tool.