Migrating RabbitMQ Services
There are two scenarios for migrating RabbitMQ services:
- Single-node or cluster RabbitMQ instances can be migrated from on-premises to on-cloud RabbitMQ instances.
- An earlier RabbitMQ instance can be migrated to a later one, for example, from 3.7.17 to 3.8.35.
Migration Principle
A RabbitMQ instance has multiple producers and consumers. To migrate services, add and remove them one by one without altering data. This process has no impact on services.
Prerequisite
A target RabbitMQ instance has been created. For details, see Buying a RabbitMQ Instance.
Implementation (Dual-Read)
- Migrate source RabbitMQ instance metadata to a target RabbitMQ instance.
Figure 1 Migrating metadata
Do as follows:
- Log in to the management UI of the source RabbitMQ. On the Overview tab page, click Download broker definitions to export the metadata.
Figure 2 Exporting metadata
- Log in to the management UI of the target RabbitMQ. On the Overview tab page, click Choose File and select the metadata exported in 1.a, and click Upload broker definitions to upload the metadata.
Figure 3 Importing metadata
- Log in to the management UI of the source RabbitMQ. On the Overview tab page, click Download broker definitions to export the metadata.
- Add new consumers for the target RabbitMQ instance.
Figure 4 Adding new consumers
- Add new producers for the target RabbitMQ instance and remove the producers of the source RabbitMQ instance. The old consumers continue consuming messages from the source RabbitMQ instance.
Figure 5 Migrating producers
- After the old consumers have consumed all messages from the source RabbitMQ instance, remove them along with the source RabbitMQ instance.
Figure 6 Removing an old consumer and a source RabbitMQ instance
Check After Migration
Check whether the consumption from the source instance is complete in either of the following ways:
- Using the RabbitMQ management UI, as shown in Figure 7.
On the Overview tab page, if the number of messages that can be consumed (Ready) and the number of messages that are not acknowledged (Unacked) are both 0, the consumption is complete.
- Calling an API
curl -s -u username:password -XGET http://ip:port/api/overview
Parameter description:
- username: account of the source instance to log in to the RabbitMQ management UI
- password: password of the source instance to log in to the RabbitMQ management UI
- ip: IP address of the source instance to log in to the RabbitMQ management UI
- port: port of the source instance to log in to the RabbitMQ management UI
The consumption is complete when messages_ready and messages_unacknowledged values in the command output are both 0.
Figure 8 Command output
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.