rabbitmq migration queue lost

Environment

Centos7.9
rabbitmq 3.3.5
Alibaba Cloud EC2

Background

Received a request to migrate the server where rabbitmq is located to another account. The old server is referred to as O and the new server is referred to as N. There is no special operation, just simply mirroring O and restoring it to N. When starting the N server, it was found that the rabbitmq account was lost and a lot of queues were also lost.

Reason:

It must be caused by migration. I have encountered it before because the computer name changed, which led to the change of server information. But this time the machine name is the same, so I didn’t check it further. I just redid the permissions.

Solution:

  1. Add an account again
  2. Export the queue of O and import it to N
1
2
3
4
5
Export the queue on the O server
curl -u <username>:<password> http://<source_host>:<source_port>/api/definitions > rabbit_definitions.json
Import the queue on the N server
curl -u <username>:<password> -H "Content-Type: application/json" -X POST -d @rabbit_definitions.json http://<destination_host>:<destination_port>/api/definitions