If the metadata file of a RabbitMQ cluster contains more than 10 vhosts, the import of the metadata file to a Message Queue for RabbitMQ instance may time out. In this case, we recommend that you split the metadata file and import the metadata in batches. The metadata is imported to Message Queue for RabbitMQ based on the vhosts list. When you split the metadata file, you need only to modify the vhosts list.

Prerequisites

The metadata file of your RabbitMQ cluster is exported. All vhosts of the cluster are contained in the file. For more information, see Migrate metadata.

Background information

A metadata file that contains 16 vhosts is used as an example. vhosts lists in the metadata file:
{
    "vhosts":[
        {
            "name":"hello1"
        },
        {
            "name":"hello_amqp"
        },
        {
            "name":"helloAMQP"
        },
        {
            "name":"example2test"
        },
        {
            "name":"example3test"
        },
        {
            "name":"example4test"
        },
        {
            "name":"example5test"
        },
        {
            "name":"example6test"
        },
        {
            "name":"example7test"
        },
        {
            "name":"example8test"
        },
        {
            "name":"example9test"
        },
        {
            "name":"example10test"
        },
        {
            "name":"example11test"
        },
        {
            "name":"example12test"
        },
        {
            "name":"example13test"
        },
        {
            "name":"example14test"
        }
    ]
}

Split the metadata file

  1. Create two replicas for the exported metadata file and name them 10vhost.json and 6vhost.json.
  2. In the vhosts list of the 10vhost.json file, delete the first six vhosts.
    vhosts list in the 10vhost.json file after deletion:
    {
        "vhosts":[
            {
                "name":"example5test"
            },
            {
                "name":"example6test"
            },
            {
                "name":"example7test"
            },
            {
                "name":"example8test"
            },
            {
                "name":"example9test"
            },
            {
                "name":"example10test"
            },
            {
                "name":"example11test"
            },
            {
                "name":"example12test"
            },
            {
                "name":"example13test"
            },
            {
                "name":"example14test"
            }
        ]
    }
  3. In the vhosts list of the 6vhost.json file, delete the last 10 vhosts.
    vhosts list in the 6vhost.json file after deletion:
    {
        "vhosts":[
            {
                "name":"hello1"
            },
            {
                "name":"hello_amqp"
            },
            {
                "name":"helloAMQP"
            },
            {
                "name":"example2test"
            },
            {
                "name":"example3test"
            },
            {
                "name":"example4test"
            }
        ]
    }