Migrating RabbitMQ Services
Scenario
There are two RabbitMQ service migration scenarios:
- Migrating an on-premises single-node or cluster RabbitMQ instance to a cloud RabbitMQ instance.
- Migrating an earlier RabbitMQ instance to a later one, for example, from 3.7.17 to 3.8.35.
Migration Principles
A RabbitMQ instance has multiple producers and consumers. Services are migrated by adding and removing consumers and producers one by one without changing data. This process does not affect services.
Preparation
A cloud RabbitMQ instance has been created. For details, see Buying an 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
- Remove the old consumers and the source RabbitMQ instance after the old consumers have consumed all messages from the source RabbitMQ instance.
Figure 6 Removing an old consumer and a source RabbitMQ instance
Check After Migration
Check whether all messages in the source instance have been consumed by using the following methods:
- 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.
- Using an API
curl -s -u username:password -XGET http://ip:port/api/overview
Parameter description:
- username: account used to log in to the RabbitMQ Management UI for the source instance
- password: password used to log in to the RabbitMQ Management UI for the source instance
- ip: IP address used to log in to the RabbitMQ Management UI for the source instance
- port: port used to log in to the RabbitMQ Management UI for the source instance
When the values of messages_ready and messages_unacknowledged in the command output are both 0, the consumption is complete.
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot