当前位置:网站首页>Oceanus practice consumption CMQ subject model data source
Oceanus practice consumption CMQ subject model data source
2022-06-24 05:31:00 【Raigor】
Oceanus Flink CMQ connector Support the data source table and destination table of queue model , The topic model data source table and destination table are not supported at the moment .CMQ Topic subscription can synchronize topic model data to queue model in real time , With this mechanism , We can do it in Oceanus Realization CMQ Reading of topic model data source table .
1. Environment building
1.1 establish Oceanus colony
stay Oceanus Console 【 Cluster management 】->【 New cluster 】 Page create cluster , Choose the region 、 Availability zone 、VPC、 journal 、 Storage , Set the initial password, etc .
If not used before VPC, journal , Store these components , You need to create it first .
The created cluster is as follows :
1.2 newly build CMQ The theme
stay CMQ Console 【 Theme subscription 】-> 【 newly build 】 The theme , Enter the topic name , Others can keep the default value . The new theme is as follows :
1.3 newly build CMQ queue
stay CMQ Console 【 queue 】-> 【 newly build 】 The theme , Enter the queue name 、 Message lifecycle 、 Maximum number of stacked messages , Others can keep the default value . Let's create two new queues here , One of them is used to subscribe to CMQ Subject model data , The other is used as Oceanus The purpose table of the operation . The new theme is as follows :
1.4 newly build CMQ Theme subscription
stay CMQ Topic list page , Click... In the subject action column 【 subscribe 】 link , Get into 【 subscriber 】 list , New subscription , Enter the subscription name , Terminal type selection Queue Queue service , Subscription address selection cs2 Queues , Others remain at default . The new subscribers are as follows :
2. Job creation
2.1 establish SQL Homework
stay Oceanus Console 【 Job management 】->【 New job 】-> SQL Homework , Select the cluster creation job just created . Then at the end of the assignment 【 Development and debugging 】->【 Operation parameters 】 Add necessary connector cmq-1.1.1.
2.2 Create data source table and destination table
At the end of the job 【 Development and debugging 】->【 Insert template 】 choice CMQ Read & Write template , And add . Modify the parameters queue、secret-id、secret-key.
Be careful : It is strongly recommended to use a with minimal permissions secret-id and secret-key, And keep it confidential , Prevent safety risks caused by leakage .
CREATE TABLE `CMQSourceTable` (
`id` bigint,
`request_method` varchar(80),
`response` varchar(80),
PRIMARY KEY (`id`) NOT ENFORCED -- If you want to do data De duplication , You need to specify PK, Distinguish different data according to this primary key
) WITH (
'connector' = 'cmq', -- It has to be for 'cmq'
'hosts' = 'http://cmq-nameserver-vpc-gz.api.tencentyun.com', --cmq Of the region nameServer
'queue' = 'cs2', --cmq Name of the queue
'secret-id' = 'Your SecretId', -- account number secretId
'secret-key' = 'Your SecretKey', -- account number secretKey
'sign-method' = 'HmacSHA1', -- The way of signing
'format' = 'csv', -- Define the data format (JSON Format )
'batch-size' = '16', -- Number of mass consumption messages / Number of messages sent in batch
'request-timeout' = '5000ms', -- The timeout for the request
'polling-wait-timeout'= '10s', --source Parameters ; Wait time when data cannot be obtained
'key-alive-timeout'= '5min', --source Parameters ; contain primary key The news of ,CMQ Effective time for weight removal
'retry-times' = '3', --sink Parameters ; Number of retries to send message
'max-block-timeout' = '0s' --sink Parameters ; Maximum waiting time for batch sending data
);
CREATE TABLE `CMQSinkTable` (
`id` bigint,
`request_method` varchar(80),
`response` varchar(80),
PRIMARY KEY (`id`) NOT ENFORCED -- If you want to do data De duplication , You need to specify PK, Distinguish different data according to this primary key
) WITH (
'connector' = 'cmq', -- It has to be for 'cmq'
'hosts' = 'http://cmq-nameserver-vpc-gz.api.tencentyun.com', --cmq Of the region nameServer
'queue' = 'sink_queue', --cmq Name of the queue
'secret-id' = 'Your SecretId', -- account number secretId
'secret-key' = 'Your SecretKey', -- account number secretKey
'sign-method' = 'HmacSHA1', -- The way of signing
'format' = 'csv', -- Define the data format (JSON Format )
'batch-size' = '16', -- Number of mass consumption messages / Number of messages sent in batch
'request-timeout' = '5000ms', -- The timeout for the request
'polling-wait-timeout'= '10s', --source Parameters ; Wait time when data cannot be obtained
'key-alive-timeout'= '5min', --source Parameters ; contain primary key The news of ,CMQ Effective time for weight removal
'retry-times' = '3', --sink Parameters ; Number of retries to send message
'max-block-timeout' = '0s' --sink Parameters ; Maximum waiting time for batch sending data
);
insert into CMQSinkTable select * from CMQSourceTable;2.3 Operator operation
Only the simplest data insertion is done here .
insert into CMQSinkTable select *from CMQSourceTable;
3. Validation summary
stay CMQ The console is called test Send a message in the subject of , Can be found in sink_queue Message received in queue .
边栏推荐
- [performance test] 3 How to calculate the number of concurrent users
- Distributed background task load balancing
- Where does the website domain name buy a normal domain name? What is the approximate price
- IBM v3700 brief configuration process
- Learning routes and materials for cloud native O & M engineers
- Have you got the programmer's drawing tools and skills?
- What domain name is cheap? How much does it cost to register a domain name?
- Easy to understand JDBC tutorial - absolutely suitable for zero Foundation
- [competition experience sharing] [Tencent internal track rank6] goose Rose Square half hand (TAS) experience
- The 2021 smart Expo is about to open. Tencent Youtu and "Ai Gallery" will "Chongqing" with you
猜你喜欢
What cloud native knowledge should programmers master?

How does win10 turn off f1~f12 shortcut keys?
Learning routes and materials for cloud native O & M engineers
Easy to understand JDBC tutorial - absolutely suitable for zero Foundation

Answer questions! This article explains the automated testing framework in software testing from beginning to end

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players

How should we learn cloud native in 2022?
随机推荐
To create a high-quality geek for human beings, cloud + community starts the competition "discovery plan"
What is the learning path for model deployment optimization?
Use cloud functions to receive callbacks and cooperate with CLS to view callback logs and persistent storage
Talk about my working experience in Tencent and byte
What are the stages from tradition to Tencent cloud
CLB health check principle and abnormal troubleshooting
[sharing of competition experience] Rank5 in goose Rose Square - hard search
Edgegallery: MEC open source platform extends 5g capability to the edge
What is the meaning of domain name being walled and what is the solution
Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
Where does the website domain name buy a normal domain name? What is the approximate price
How to register a domain name how to make the domain name short and easy to remember
How to register a first level domain name what is a first level domain name
How to apply for domain name space? Will it be difficult to apply for domain name space?
[the lottery in June has ended, and the list of winners has been announced] special cloud development session of techo Youth College Open Class
What is the subdomain name and how to register the domain name
TDP members have made their debut!
Why do hybrid clouds exist?
Go's package management learning notes
What domain name is top? What are the advantages of the top domain name?