Before you create a data migration or synchronization project, you must create the data sources. This topic describes how to create a RocketMQ data source by using the data transmission service.
Prerequisites
The data transmission service has the privilege to access cloud resources. For more information, see Grant privileges to roles for data transmission.
You have created a group in the RocketMQ instance. For more information, see Create a group.
You have created a topic named
oms_test_topic
in the RocketMQ instance.
Limitations
The data transmission service supports RocketMQ instances of versions 4.x and 5.x, including the commercial and community editions.
For a self-managed RocketMQ instance in a virtual private cloud (VPC), add the CIDR block of the corresponding VPC to the security group of the Elastic Compute Service (ECS) instance where the RocketMQ instance is to be installed, and enable all ports of the namesvr and broker of the RocketMQ instance.
Procedure
Log on to the ApsaraDB for OceanBase console.
In the left-side navigation pane, choose Data Transmission > Data Source Management.
On the Data Sources page, click New Data Source in the upper-right corner.
In the New Data Source dialog box, select RocketMQ for Data Source Type.
Configure the following parameters. Select an instance type from the Instance Type drop-down list. The corresponding configuration section automatically appears.
Instance Type
Parameter
Description
Alibaba Cloud RocketMQ instance
Instances
The data source. You can select an Alibaba Cloud RocketMQ instance from the drop-down list.
Self-managed RocketMQ instance in VPC
VPC
Select the unique ID of the VPC that you applied for from the drop-down list.
vSwitch
A vSwitch is a basic network module of a VPC and is used to connect cloud resource instances. For more information, see Overview.
Common parameters
All common parameters in a RocketMQ instance in the public network
Data Source Identifier
We recommend that you set it to a combination of digits and letters. It must not contain any spaces and cannot exceed 32 characters in length.
RocketMQ Endpoint Information
The endpoint of the RocketMQ database, which is in the format of IP address:port number or domain name:port number.
AccessKey
The AccessKey ID that you created in the Resource Access Management (RAM) console for identity authentication.
You can hover over the user avatar in the upper right corner of the page and click AccessKey Management to view the AccessKey ID.
SecretKey
The AccessKey secret that you created in the RAM console for identity authentication.
The AccessKey secret is displayed only once when you first create it. You cannot retrieve the AccessKey secret if you forget it. We recommend that you save the AccessKey secret for subsequent use. For more information, see Create an AccessKey pair.
Remarks (Optional)
Additional information about the data source.
Click Test Connection to test the network connection between the data transmission system and the source database.
ImportantIf you do not create the
oms_test_topic
topic, the test will fail.After the test is passed, click OK.
Create a group
Before creating a RocketMQ data source, you need to create defaultGroup in advance. Otherwise, the test connection fails.
Alibaba Cloud RocketMQ instance
Go to the details page of the RocketMQ instance.
Log on to the Message Queue for Apache RocketMQ console.
In the left-side navigation pane, click Instances.
In the instance list, click the name of the target instance. The Instances page appears.
In the left-side navigation pane, click Groups.
On the Groups page, click Create Group and set the parameters.
The parameters vary with the version of the RocketMQ instance. For more information, see Manage groups.
ImportantWhen you create a group, the group ID must be set to defaultGroup.
After you set the parameters, click OK.
Create a topic named oms_test_topic.
On the instance details page, click Topics in the left-side navigation pane.
On the Topics page, click Create Topic.
In the Create Topic dialog box, configure the parameters.
Parameter
Description
Parameter
Set this parameter to oms_test_topic.
Billing methods
This parameter is available only for RocketMQ instances of version 4.x, and supports Pay-as-you-go only.
Message Type
RocketMQ instances of version 4.x support Normal Message, Transactional Message, Partitionally Ordered Message, Globally Ordered Message and Scheduled/Delayed Message.
RocketMQ instances of version 5.x support Normal Message, Ordered Message, Scheduled/Delayed Message, and Transactional Message.
Description
It can contain a maximum of 128 characters.
After you set the parameters, click OK.
Self-managed RocketMQ instance in a VPC
Perform the following steps to create a group and topic for a self-managed RocketMQ instance in a VPC, no matter whether the instance is of the commercial or community edition:
Go to the RocketMQ directory on the machine and run the following command to create defaultGroup:
./bin/mqadmin updateSubGroup -n 10.10.10.1:2882 -c DefaultCluster -g defaultGroup
Run the following command to create a topic named oms_test_topic:
./bin/mqadmin updateTopic -t oms_test_topic -n 10.10.10.1:2882 -c DefaultCluster