All Products
Search
Document Center

ApsaraMQ for RocketMQ:Export and import topic data

Last Updated:Jan 31, 2024

ApsaraMQ for RocketMQ allows you to export the topic data of an instance and then import the data to another ApsaraMQ for RocketMQ instance to synchronize topic data across instances. When you change or clone an instance, you can use the topic data export and import feature to quickly create topics that have the same basic information as the topics on the original instance.

Background information

ApsaraMQ for RocketMQ allows you to export the topic data of a specific instance and then import the data to another ApsaraMQ for RocketMQ instance. You can use the topic data export and import feature in the following scenarios:

  • Change an instance

    You can use this feature when you change an instance. For example, if your ApsaraMQ for RocketMQ 4.x instance does not meet your business requirements and you want to change the instance to an ApsaraMQ for RocketMQ 5.x instance, you can use this feature to export the topic data of the 4.x instance and then import the data to the 5.x instance. This way, the topics that you use in your 4.x instance can be automatically created on the 5.x instance.

  • Clone an instance

    You can use this feature when you deploy different ApsaraMQ for RocketMQ instances and want your business to access the same topics in development, test, and production environments. In this case, you can create related topics in one of the deployed instances, use this feature to export the topic data, and then import the data to other instances to quickly create the same topics.

Usage notes

  • The topic data export and import feature supports cross-version import and export. For example, you can export the topic data of an ApsaraMQ for RocketMQ 4.x instance and then import the data to an ApsaraMQ for RocketMQ 5.x instance.

  • When you export or import topic data, only basic information about the topics is exported or imported, such as the names, message types, and descriptions of the topics. Messages in the topics are not changed or migrated.

  • When you import topic data, the values of the parameters in the file to be imported must meet specific requirements. For more information, see Step 5 of the "Import topic data" section of this topic.

Export topic data

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. In the left-side navigation pane, click Topics.

  4. In the upper-right corner of the Topics page, click the 导出 icon.

    The system exports the topic data of the instance and saves the data to an .xlsx file.

Import topic data

You can directly import the exported topic data to a destination instance. You can also update the exported topic data based on your business requirements before you import the data to the destination instance.

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. In the left-side navigation pane, click Topics.

  4. In the upper-right corner of the Topics page, click the 导入 icon.

  5. Select the topic data file that you saved and click Open.

    The following table describes the requirements on the parameter values in the topic data file to be imported.

    Parameter

    Description

    Valid value

    TopicName

    The topic name.

    • A topic name can contain letters, digits, underscores (_), and hyphens (-).

    • A topic name must be 1 to 60 characters in length.

    A topic name cannot contain strings that are reserved for the system or strings that contain special prefixes. For more information, see Limits on parameters.

    MessageType

    The message type of the topic.

    Valid values:

    • TRANSACTION: transactional messages

    • DELAY: scheduled or delayed messages

    • FIFO: ordered messages

    • NORMAL: normal messages

    Remark

    The topic description.

    The topic description must be 1 to 60 characters in length.

    Example:

    TopicName

    MessageType

    Remark

    Topic1

    TRANSACTION

    Used to send transactional messages.

    Topic2

    NORMAL

    Used to send normal messages.

    Topic3

    DELAY

    Used to send delayed messages.

  6. In the Import Resources panel, select the topic whose data you want to import and click Confirm and Import in the Actions column.

    You can also select multiple topics and click Batch Import.

    After the topic data is imported, the values of the Execution Results column of the topic list change to Imported.

  7. In the lower-left corner of the Import Resources panel, click OK to complete the import.

    After the topic data is imported, the topics whose data is imported appear in the topic list.

References