This topic describes how to migrate the metadata of an open source RabbitMQ cluster to an ApsaraMQ for RabbitMQ instance or a vhost on an ApsaraMQ for RabbitMQ instance.
Prerequisites
The metadata that you want to migrate is exported. For more information, see Export the metadata of all vhosts or a specified vhost.
An ApsaraMQ for RabbitMQ instance and a vhost to which you want to migrate the metadata are created.
To migrate the metadata of all vhosts in an open source RabbitMQ cluster, create an ApsaraMQ for RabbitMQ instance. For more information, see the "Create an instance" section of the Manage instances topic.
To migrate the metadata of a specific vhost in an open source RabbitMQ cluster, create an ApsaraMQ for RabbitMQ instance and a vhost in the instance. For more information, see the Create an instance and Create a vhost.
Background information
The metadata of an open source RabbitMQ cluster includes information about the users, vhosts, queues, exchanges, binding keys, permissions, and parameters of the cluster. The metadata of an open source RabbitMQ cluster is stored in an internal database of the cluster and is automatically replicated among all nodes of the cluster.
Each node has a metadata replica. If the metadata of a node changes, the metadata of all nodes is updated. This way, the metadata files that are exported from each node of the cluster are the same.
To back up the metadata of an open source RabbitMQ cluster, export the metadata to a JSON file and import the file to another open source RabbitMQ cluster.
To migrate metadata to the cloud is the process to migrate the metadata of an open source RabbitMQ cluster to an ApsaraMQ for RabbitMQ instance. ApsaraMQ for RabbitMQ is a fully managed message queue service provided by Alibaba Cloud. This service is compatible with open source RabbitMQ. You can export the metadata of an open source RabbitMQ cluster and import the metadata to an ApsaraMQ for RabbitMQ instance. Then, ApsaraMQ for RabbitMQ creates the corresponding vhosts, queues, exchanges, and bindings in the ApsaraMQ for RabbitMQ instance based on the imported metadata.
You can import the metadata of all vhosts in an open source RabbitMQ cluster to an ApsaraMQ for RabbitMQ instance or import the metadata of a specific vhost in an open source RabbitMQ cluster to a vhost in an ApsaraMQ for RabbitMQ instance.
Usage notes
If you want to import the metadata of all vhosts on an open source RabbitMQ cluster, make sure that the imported metadata file in the JSON format contains the
vhost
data and theexchange
,queue
, andbinding
data in which thevhost
information is included. For more information, see A sample JSON file.The data of vhosts, exchanges, queues, and bindings in the imported metadata file must comply with the limits on resource quotas and on the characters that can be used to name resources in ApsaraMQ for RabbitMQ. For more information, see Limits.
An ApsaraMQ for RabbitMQ instance can run only one task at a time. After the previous task is completed, you can create a new task for the instance.
Metadata compatibility
Specific metadata of open source RabbitMQ clusters cannot be imported to ApsaraMQ for RabbitMQ instances due to differences in aspects such as access control mechanisms between open source RabbitMQ and ApsaraMQ for RabbitMQ. The metadata that cannot be imported is automatically ignored when you import the metadata of open source RabbitMQ clusters to ApsaraMQ for RabbitMQ instances. The following table describes the metadata compatibility between open source RabbitMQ clusters and ApsaraMQ for RabbitMQ instances.
Metadata | Description | Compatibility |
rabbit_version | The version of the open source RabbitMQ cluster. | No |
users | The users of the open source RabbitMQ cluster. | No Important If the metadata file of your RabbitMQ cluster contains the data of users, you can use Resource Access Management (RAM) to implement the corresponding user management mechanism after the metadata of the cluster is migrated to an ApsaraMQ for RabbitMQ instance. For more information, see Create a RAM user. |
vhosts | The vhosts in the open source RabbitMQ cluster. | Yes |
permissions | The permissions that are granted to users to manage vhosts in the open source RabbitMQ cluster. | No Important If the users of your RabbitMQ cluster are granted permissions to manage vhosts, you can use RAM to grant the users the required permissions to manage vhosts after the metadata of the cluster is migrated to an ApsaraMQ for RabbitMQ instance. For more information, see RAM policies. |
parameters | The runtime parameters for the open source RabbitMQ cluster. | No |
global_parameters | The global runtime parameters for the open source RabbitMQ cluster. | No |
policies | The vhost runtime parameters for the open source RabbitMQ cluster. The parameters include the optional parameters that can be used for exchanges and queues in a vhost. | No Important If your RabbitMQ cluster is configured based on the vhost runtime parameters, you can specify the corresponding optional parameters when you create exchanges and queues in the ApsaraMQ for RabbitMQ console. After an exchange or a queue is created, you cannot modify the optional parameters. If you want to modify the optional parameters for an exchange or a queue, you must delete the exchange or queue and create another exchange or queue. For more information, see Create an exchange and Create a queue. |
queues | The queues of the open source RabbitMQ cluster. | Yes |
exchanges | The exchanges of the open source RabbitMQ cluster. | Yes |
bindings | The bindings between the exchanges and queues of the open source RabbitMQ cluster. | Yes |
Migrate metadata
Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Migration to Cloud.
On the Migration to Cloud page, select a region in the top navigation bar and click Create Task in the upper-left corner.
In the Create Task panel, configure the parameters and click OK.
Parameter
Description
Example
Instance
The name of the instance to which you want to migrate the metadata.
amqp-cn-7mz2cjgk****
Import Method
Specifies whether to import the metadata of all vhosts in the open source RabbitMQ cluster to the ApsaraMQ for RabbitMQ instance or import the metadata of a specific vhost in the open source RabbitMQ cluster to a vhost in the ApsaraMQ for RabbitMQ instance. Valid values:
ALL: Import the metadata of all vhosts in the open source RabbitMQ cluster to the ApsaraMQ for RabbitMQ instance.
Vhost: Import the metadata of a specific vhost in the open source RabbitMQ cluster to a vhost in the ApsaraMQ for RabbitMQ instance.
Vhost
vhost
The vhost to which you want to migrate the metadata. This parameter is available only if the Import Method parameter is set to Vhost.
test-vhost****
Metadata
The metadata file that you want to migrate. To migrate the metadata file, click Select File, select the metadata file that you store on your on-premises device, and then click Open.
NoteThe metadata file cannot exceed 20 MB in size.
rabbit_mq-amqp-load-test011122063****
On the Migration to Cloud page, the created migration task appears and you can view the task status.
For information about how to view the imported metadata and the cause of a failed task, see Related operations.
Related operations
After you create a task to migrate metadata, you can view the details of the imported metadata. If the task fails, you can view the cause of the failure.
View the imported metadata
On the Migration to Cloud page, find the migration task that you want to manage and click the name of the instance in the Destination Instance column.
In the left-side navigation pane, click vhosts. On the vhosts page, find the vhost to which you migrated the metadata and click Details in the Actions column to view the vhost details.
For more information, see View the information about the connection that is established to a vhost.
View the cause of a failed task
On the Migration to Cloud page, find the migration task that you want to manage and click Details in the Actions column.
You can also perform the following operation: On the Migration to Cloud page, find the migration task that you want to manage and click the value in the vhosts for Synchronization, Exchanges for Synchronization, Queues for Synchronization, or Bindings for Synchronization column.
On the Migration Details page, click the Failed vhosts, Failed Exchanges, Failed Queues, and Failed Bindings tabs to view the failure cause.