Migrating RocketMQ Services
Scenario
You can migrate RocketMQ services from other vendors or your self-built RocketMQ to HUAWEI CLOUD Distributed Message Service (DMS) for RocketMQ.
Prerequisites
- Configure the network environment.
A RocketMQ instance can be accessed within a VPC or over a public network. For public network access, the producer and consumer must have public access permissions, and the following security group rules must be configured.
Table 1 Security group rules Direction
Protocol
Port
Source
Description
Inbound
TCP
8200
0.0.0.0/0
The port is used for public access to metadata nodes.
Inbound
TCP
10100-10199
0.0.0.0/0
The port is used for accessing service nodes.
- Buy a RocketMQ instance.
For details, see Buying a RocketMQ Instance.
Procedure
- Migrate metadata to the RocketMQ instance.
- Obtain the RocketMQ metadata from another cloud or self-hosted RocketMQ.
- Go to the RocketMQ installation directory and query the cluster name with the following command:
sh ./bin/mqadmin clusterList -n {nameserver address and port number}
For example, if the nameserver address and port number are 192.168.0.65:8100, run the following command:
sh ./bin/mqadmin clusterList -n 192.168.0.65:8100
- Run the following command to export metadata:
sh ./bin/mqadmin exportMetadata -n {nameserver address and port number} -c {RocketMQ cluster name} -f {Path for storing the exported metadata file}
For example, if the nameserver address and port number are 192.168.0.65:8100, the RocketMQ cluster name is DmsCluster, and the path for storing exported metadata files is /tmp/rocketmq/export, run the following command:
sh ./bin/mqadmin exportMetadata -n 192.168.0.65:8100 -c DmsCluster -f /tmp/rocketmq/export
- Go to the RocketMQ installation directory and query the cluster name with the following command:
- Migrate metadata on the console.
- Log in to the DMS for RocketMQ console.
- Click a RocketMQ instance to go to the instance details page.
- In the navigation pane, choose Metadata Migration.
- Click Create Migration Task.
- Configure the migration task by referring to Table 2.
Table 2 Migration task parameters Parameter
Description
Task Name
Unique name of the migration task.
Overwrite
- If this option is enabled, configurations in the metadata file with the same name as the uploaded file will be modified.
Assume that Topic01 on the source instance has three read queues, and Topic01 on the DMS instance has two read queues. If Overwrite is enabled, Topic01 on the DMS instance will have three read queues after migration.
- If this option is disabled, migration of the metadata file with the same name as the uploaded file will fail.
Assume that the source instance has Topic01 and Topic02, and the DMS instance has Topic01 and Topic03. If Overwrite is disabled, migration of the source Topic01 will fail.
Metadata
Upload the RocketMQ metadata obtained from another cloud or self-hosted RocketMQ.
- If this option is enabled, configurations in the metadata file with the same name as the uploaded file will be modified.
- Click OK.
After the migration is complete, view Task Status in the migration task list.
- If Task Status is Complete, all metadata has been successfully migrated.
- If Task Status is Failed, some or all metadata fails to be migrated. Click the migration task name to go to the migration task details page. In the Migration Result area, view the name of the topic or consumer group that fails to be migrated and the failure cause.
- Obtain the RocketMQ metadata from another cloud or self-hosted RocketMQ.
- Migrate the production service to the RocketMQ instance.
Change the metadata connection address on the production client to the metadata connection address of the RocketMQ instance and then restart the production service. New messages will be sent to the RocketMQ instance.
- Migrate the consumption service to the RocketMQ instance.
After all messages in the consumer group are consumed, change the metadata connection address of the consumer client to the metadata connection address of the RocketMQ instance. New messages will be consumed from the RocketMQ instance.
- If there are multiple source RocketMQ instances, migrate services from them one by one.
Feedback
Was this page helpful?
Provide feedbackFor any further questions, feel free to contact us through the chatbot.
Chatbot