All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Migrate the metadata of an open source RabbitMQ cluster to an ApsaraMQ for RabbitMQ instance

Last Updated:Apr 22, 2024

You can export the metadata of an open source RabbitMQ cluster and then import the metadata to an ApsaraMQ for RabbitMQ instance. After the metadata is imported, ApsaraMQ for RabbitMQ creates vhosts, queues, exchanges, and bindings on the ApsaraMQ for RabbitMQ instance based on the imported metadata. This way, the metadata of the open source RabbitMQ cluster is migrated. You can export the metadata of all vhosts or a specific vhost from an open source RabbitMQ cluster.

Prerequisites

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. The metadata content of each node in the cluster is the same.

Limits

Open source RabbitMQ and ApsaraMQ for RabbitMQ use different permission control mechanisms. The following metadata in an open source RabbitMQ cluster cannot be imported to an ApsaraMQ for RabbitMQ instance and are automatically ignored: rabbit_version, users, permissions, parameters, global_parameters and policies.

Export the metadata of an open source RabbitMQ cluster

You can export the metadata of all vhosts or a specific vhost from an open source RabbitMQ cluster.

Use the open source RabbitMQ console to export metadata

  1. Open the open source RabbitMQ console in a browser.

    http://Your RabbitMQ IP address:15672/.

  2. On the RabbitMQ logon page, enter your username in the Username field and your password in the Password field. Then, click Login.

  3. On the Overview tab, click Export definitions, select All or a specific vhost from the Virtual host drop-down list, and then click Download broker definitions.

    The following options can be selected from the Virtual host drop-down list:

    • All: Export the metadata of all vhosts.

    • vhost name: Export the metadata of a specific vhost.

    image

  4. Save the downloaded metadata file to your on-premises machine.

Use the HTTP-based API of open source RabbitMQ to export metadata

  1. Open the terminal.

  2. Use one of the following methods to export the metadata file of an open source RabbitMQ cluster:

    • Export the metadata of all vhosts.

      wget --user <Your RabbitMQ account> --password <Your RabbitMQ password> http://<Your RabbitMQ IP address>:15672/api/definitions -O <The path to which the metadata file is saved>
    • Export the metadata of a specific vhost.

      wget --user <Your RabbitMQ account> --password <Your RabbitMQ password> http://<Your RabbitMQ IP address>:15672/api/definitions -O <The path to which the metadata file is saved> --vhost <vhost name>

Import the metadata of an open source RabbitMQ cluster to an ApsaraMQ for RabbitMQ instance

  1. Log on to the ApsaraMQ for RabbitMQ console. In the left-side navigation pane, click Migration to Cloud.

  2. On the page that appears, select the region where the ApsaraMQ for RabbitMQ instance that you want to manage resides in the top-navigation bar and click Create Task.

  3. In the Create Task panel, configure the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    Example

    Instance

    The name of the ApsaraMQ for RabbitMQ instance to which the metadata is migrated.

    amqp-cn-7mz2cjgk****

    Import Method

    • 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 on the ApsaraMQ for RabbitMQ instance.

    Vhost

    vhost

    The vhost to which you want to migrate the metadata. This parameter is available only if you set the Import Method parameter 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 machine, and then click Open.

    Note

    The metadata file cannot exceed 20 MB in size.

    rabbit_mq-amqp-load-test011122063****

    If you migrate the metadata of an open source RabbitMQ cluster by creating a migration task, you can view the metadata and the cause of task failures.

    • View the imported metadata

      1. 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.

      2. 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 task failure

      1. 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.

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