Migrate metadata from an open source RabbitMQ cluster to an Alibaba Cloud ApsaraMQ for RabbitMQ instance by exporting the metadata and then importing it. After a successful import, ApsaraMQ for RabbitMQ creates the corresponding vhosts, queues, exchanges, and bindings in the destination ApsaraMQ for RabbitMQ instance. Open source RabbitMQ supports exporting metadata for all vhosts or for a specific vhost.
Prerequisites
Create an ApsaraMQ for RabbitMQ instance and a vhost to serve as the migration destination. For more information, see Create an instance and Create a vhost.
NoteSelect a Serverless dedicated instance. This instance type supports the open source identity verification and permission model, which allows for a seamless migration from open source RabbitMQ to the cloud.
Background information
The metadata of a RabbitMQ cluster includes information such as users, vhosts, queues, exchanges, routing keys, permissions, and parameters. This metadata is stored in the cluster's internal database and is automatically replicated across all nodes. Therefore, all nodes in the cluster have the same metadata.
Limits
The limits vary based on the identity verification and permission model of the instance. For a successful migration, select an instance that uses the open source identity verification and permission management model.
Open source identity verification and permission management
Due to incompatibilities between open source RabbitMQ and ApsaraMQ for RabbitMQ, the
rabbit_version,parameters,global_parameters, orpoliciesmetadata is automatically ignored during the import and cannot be imported into an ApsaraMQ for RabbitMQ instance.The guest user cannot be imported. If you attempt to import the guest user, the user and its permissions are not created.
Users without passwords can be imported, but they cannot connect to or access the instance.
Because ApsaraMQ for RabbitMQ does not support permission management based on user tags, the
tagsproperty in theusersdata is not imported.
Resource Access Management (RAM)
Because the permission management of open source RabbitMQ is different from Resource Access Management (RAM), the
rabbit_version,users,permissions,parameters,global_parameters, andpoliciesmetadata is automatically ignored during the import process and cannot be imported into an ApsaraMQ for RabbitMQ instance.
Export open source RabbitMQ metadata
You can export the metadata of all vhosts or a specific vhost from an open source RabbitMQ cluster.
Export from the open source RabbitMQ console
Open the open source RabbitMQ console in a browser.
The URL for the open source RabbitMQ console is:
http://<your_rabbitmq_ip_address>:15672/On the logon page, enter your username in the Username text box and your password in the Password text box, and then click Login.
On the Overview tab, click Export definitions. From the Virtual host list, select All or a specific vhost name, and then click Download broker definitions.
The following table describes the options in the Virtual host list.
All: Exports the metadata for all vhosts.
Vhost name: Exports the metadata for a specific vhost.

Save the downloaded metadata file to your computer.
Export using the open source RabbitMQ HTTP API
Open the terminal.
Run the following command to export the RabbitMQ cluster metadata file.
To export the metadata of all vhosts:
wget --user <your_rabbitmq_username> --password <your_rabbitmq_password> http://<your_rabbitmq_ip_address>:15672/api/definitions -O <path/to/save/metadata_file>To export the metadata of a specific vhost:
wget --user <your_rabbitmq_username> --password <your_rabbitmq_password> http://<your_rabbitmq_ip_address>:15672/api/definitions -O <path/to/save/metadata_file> --vhost <vhost_name>
Import metadata to ApsaraMQ for RabbitMQ
Log in to the ApsaraMQ for RabbitMQ console. In the navigation pane on the left, 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, set the parameters and click OK.
Parameter
Description
Example
Instance
The name of the destination instance to which the metadata is migrated.
amqp-cn-7mz2cjgk****
Import Method
ALL: imports the metadata of all vhosts from the open source RabbitMQ cluster to the ApsaraMQ for RabbitMQ instance.
Vhost: imports the metadata of a specific vhost from the open source RabbitMQ cluster to a vhost of the ApsaraMQ for RabbitMQ instance.
Vhost
vhost
The vhost in the ApsaraMQ for RabbitMQ instance to which you want to migrate the metadata. This parameter is displayed when you set Import Method to Vhost.
test-vhost****
Metadata
The metadata file to be migrated. Click Select File, select the local metadata file, and then click Open.
NoteThe metadata file cannot exceed 20 MB.
rabbit_mq-amqp-load-test011122063****
After you create a metadata migration task, you can view the metadata details and the causes of any task failures.
View details of successfully imported metadata
On the Migration to Cloud page, find the task and click its instance name in the Destination Instance column.
In the navigation pane on the left, click Vhosts. Find the destination vhost and click Details in the Actions column.
For more information, see View vhost connection details.
View details of a failed task
On the Migration to Cloud page, find the task, and in the Actions column, click Details.
Alternatively, on the Migration to Cloud page, find the destination instance and click the number of synchronized metadata.
On the Migration Details page, click the Vhost, Exchange, Queue, or Binding tab to view the cause of the failure.