Updated on 2023-06-14 GMT+08:00

Migrating Metadata

Scenario

On the console, you can migrate RocketMQ metadata from another cloud or self-hosted RocketMQ to your DMS RocketMQ instance.

Prerequisites

A RocketMQ instance has been purchased.

Step 1: Obtain RocketMQ Metadata from Another Cloud or Self-Hosted RocketMQ

  1. Download the RocketMQ software package.

    wget https://archive.apache.org/dist/rocketmq/4.9.4/rocketmq-all-4.9.4-bin-release.zip

  2. Decompress the software package.

    unzip rocketmq-all-4.9.4-bin-release.zip

  3. (Optional) If ACL is enabled for the RocketMQ instance, authentication is required when you run the mqadmin command.

    Switch to the directory where the decompressed software package is stored and add the following content to the conf/tools.yml file:
    accessKey:*******
    secretKey:*******

    accessKey and secretKey are the username and secret key set on the Users page of the console.

  4. Go to the directory where the decompressed software package is stored and run the following command to query the cluster name:

    sh ./bin/mqadmin clusterList -n {nameserver address and port number}

    For example, if the nameserver address and port number are 192.168.0.65:8100, run the following command:

    sh ./bin/mqadmin clusterList -n 192.168.0.65:8100

  5. Run the following command to export metadata:

    • If SSL is disabled, run the following command:
      sh ./bin/mqadmin exportMetadata -n {nameserver address and port number} -c {RocketMQ cluster name} -f {Path for storing the exported metadata file}

      For example, if the nameserver address and port number are 192.168.0.65:8100, the RocketMQ cluster name is DmsCluster, and the path for storing exported metadata files is /tmp/rocketmq/export, run the following command:

      sh ./bin/mqadmin exportMetadata -n 192.168.0.65:8100 -c DmsCluster -f /tmp/rocketmq/export
    • If SSL is enabled, run the following command:
      JAVA_OPT=-Dtls.enable=true sh ./bin/mqadmin exportMetadata -n {nameserver address and port number} -c {RocketMQ cluster name} -f {path for storing the exported metadata file}

      For example, if the nameserver address and port number are 192.168.0.65:8100, the RocketMQ cluster name is DmsCluster, and the path for storing exported metadata files is /tmp/rocketmq/export, run the following command:

      JAVA_OPT=-Dtls.enable=true sh ./bin/mqadmin exportMetadata -n 192.168.0.65:8100 -c DmsCluster -f /tmp/rocketmq/export

Step 2: Migrate Metadata on the Console

  1. Log in to the management console.
  2. Click in the upper left corner to select a region.

    Select the region where your RocketMQ instance is located.

  3. Click and choose Application > Distributed Message Service for RocketMQ to open the console of DMS for RocketMQ.
  4. Click a RocketMQ instance to go to the details page.
  5. In the navigation pane, choose Metadata Migration.
  6. Click Create Migration Task.
  7. Configure the migration task by referring to Table 1.

    Table 1 Migration task parameters

    Parameter

    Description

    Task Name

    Unique name of the migration task.

    Overwrite

    • If this option is enabled, configurations in the metadata file with the same name as the uploaded file will be modified.

      Assume that Topic01 on the source instance has three read queues, and Topic01 on the DMS instance has two read queues. If Overwrite is enabled, Topic01 on the DMS instance will have three read queues after migration.

    • If this option is disabled, migration of the metadata file with the same name as the uploaded file will fail.

      Assume that the source instance has Topic01 and Topic02, and the DMS instance has Topic01 and Topic03. If Overwrite is disabled, migration of the source Topic01 will fail.

    Metadata

    Upload the RocketMQ metadata obtained from another cloud or self-hosted RocketMQ.

  8. Click OK.

    After the migration is complete, view Task Status in the migration task list.

    • If Task Status is Complete, all metadata has been successfully migrated.
    • If Task Status is Failed, some or all metadata fails to be migrated. Click the migration task name to go to the migration task details page. In the Migration Result area, view the name of the topic or consumer group that fails to be migrated and the failure cause.
      Figure 1 Migration result