This topic describes how to migrate the metadata of an open source RabbitMQ cluster to a Message Queue for RabbitMQ instance or a vhost on the instance.

Prerequisites

Before you migrate the metadata, make sure that you perform the following operations:

Background information

The metadata of a RabbitMQ cluster includes information about the users, vhosts, queues, exchanges, binding keys, permissions, and parameters of the cluster. The metadata of a 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. When 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 a RabbitMQ cluster, export the metadata to a JSON file and import the file to another RabbitMQ cluster.

Metadata migration is the process of migrating the metadata of an open source RabbitMQ cluster to a Message Queue for RabbitMQ instance. Message Queue for RabbitMQ is a fully managed message queuing service provided by Alibaba Cloud. This service is compatible with open source RabbitMQ. After you export the metadata file of a RabbitMQ cluster and import the file to a Message Queue for RabbitMQ instance, Message Queue for RabbitMQ creates vhosts, queues, exchanges, and bindings in the Message Queue for RabbitMQ instance based on the imported metadata. This way, the metadata of the cluster is migrated to Alibaba Cloud. You can import the metadata of all vhosts to the Message Queue for RabbitMQ instance or import the metadata of a vhost to a vhost on the Message Queue for RabbitMQ instance based on your business requirements.

Note

  • If you want to import the metadata of all vhosts, make sure that the imported metadata file in the JSON format contains the vhost data and the exchange, queue, and binding data in which the vhost 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 the resource quotas and the limits on the characters that can be used to name resources in Message Queue for RabbitMQ. For more information, see Limits.
  • A Message Queue 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

Message Queue for RabbitMQ is different from open source RabbitMQ in aspects such as access control. Specific metadata of RabbitMQ clusters cannot be imported to Message Queue for RabbitMQ instances. The metadata that cannot be imported is automatically ignored when you import the metadata to Message Queue for RabbitMQ instances. The following table describes the metadata compatibility between RabbitMQ clusters and Message Queue for RabbitMQ instances.

Metadata Description Whether the metadata can be imported to Message Queue for RabbitMQ instances
rabbit_version The version of a RabbitMQ cluster. No
users The users of a RabbitMQ cluster. No
Notice 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 a Message Queue for RabbitMQ instance. For more information, see Create a RAM user.
vhosts The vhosts in a RabbitMQ cluster. Yes
permissions The permissions that are granted to users to manage vhosts in a RabbitMQ cluster. No
Notice 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 a Message Queue for RabbitMQ instance. For more information, see RAM policies.
parameters The runtime parameters for a RabbitMQ cluster. No
global_parameters The global runtime parameters for a RabbitMQ cluster. No
policies The vhost runtime parameters for a RabbitMQ cluster. These parameters include the optional parameters that can be used for exchanges and queues in a vhost. No
Notice 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 Message Queue 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 the queue and create another exchange or queue. For more information, see Create an exchange and Create a queue.
queues The queues of a RabbitMQ cluster. Yes
exchanges The exchanges of a RabbitMQ cluster. Yes
bindings The bindings between the exchanges and queues of a RabbitMQ cluster. Yes

Migrate metadata

  1. Log on to the Message Queue for RabbitMQ console.
  2. In the Resource Distribution section of the Overview page, select the region where your instance is located.
  3. In the left-side navigation pane, click Migration to Cloud.
  4. On the Migration to Cloud page, click Create Task.
  5. In the Create Task panel, configure the parameters and click OK.
    Parameter Description Example
    Instance The name of the instance to which the metadata is migrated. amqp-cn-7mz2cjgk****
    Import Method Specifies whether to import the metadata of all vhosts or a specified vhost to the Message Queue for RabbitMQ instance or a specified vhost on the instance.
    • ALL: Import the metadata of all vhosts in the open source RabbitMQ cluster to the Message Queue for RabbitMQ instance.
    • Vhost: Import the metadata of a specified vhost in the open source RabbitMQ cluster to a specified vhost on the Message Queue for RabbitMQ instance.
    Vhost
    Vhost The Message Queue for RabbitMQ vhost to which the metadata is migrated. This parameter is displayed when Import Method 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.
    Note The size of the metadata file cannot exceed 20 MB.
    rabbit_mq-amqp-load-test011122063****
    On the Migration to Cloud page, the created migration task appears. You can view the task status.

    For information about how to view the imported metadata and the cause of a failed task, see the "Related operations" section.

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
    1. On the Migration to Cloud page, find the migration task that you want to view and click the instance name in the Destination Instance column.
    2. In the left-side navigation pane, click vhosts. On the page that appears, find the vhost to which you migrate the metadata and click Details in the Actions column. Then, you can view the vhost details.

      For more information, see View details about a vhost.

  • View the cause of a failed task
    1. On the Migration to Cloud page, find the migration task that you want to view 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 view and click the value in the vhosts for Synchronization, Exchanges for Synchronization, Queues for Synchronization, or Bindings for Synchronization column.

    2. On the Migration Details page, click the Failed vhosts, Failed Exchanges, Failed Queues, and Failed Bindings tabs to view the failure cause.