All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Export the metadata of all vhosts or a specified vhost

Last Updated:Jul 20, 2023

You can export the metadata of all vhosts or a specified vhost from an open source RabbitMQ cluster. This topic describes how to use the open source RabbitMQ console and the HTTP-based API to export the metadata of all vhosts or a specified vhost.

Prerequisites

The RabbitMQ management plug-in is enabled. For more information, see Enable the RabbitMQ management plug-in.

Use the open source RabbitMQ console to export metadata

  1. Open your browser and enter the URL of the open source RabbitMQ console in the following format:

    http://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, expand Import/export definitions. In the Export section, select All or the name of a specified vhost from the Virtual host drop-down list. Then, click Download broker definitions.

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

    • All: exports the metadata of all vhosts.

    • vhost name: exports the metadata of a specified vhost.

  4. In the Save As dialog box, select the path to which you want to save the metadata file of the RabbitMQ cluster, and click Save.

    This way, the metadata file of the RabbitMQ cluster is exported to the specified storage path.

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 a RabbitMQ cluster:

    • Export the metadata of all vhosts.

      wget --user <RabbitMQ account> --password <RabbitMQ password> http://<RabbitMQ IP address>:15672/api/definitions -O <The storage path of the metadata file>
    • Export the metadata of a specified vhost.

      wget --user <RabbitMQ account> --password <RabbitMQ password> http://<RabbitMQ IP address>:15672/api/definitions -O <The storage path of the metadata file> --vhost <vhost name>