当前位置:网站首页>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 .
边栏推荐
- Supply chain innovation of industrial Internet cloud computing
- What is domain name resolution? How much does domain name registration cost
- TDP members have made their debut!
- What kind of intelligent connection design do we need in an interconnected society?
- What is the subdomain name and how to register the domain name
- 2021, how to select a programming language?
- The personal information protection law was formally reviewed and passed. What issues should enterprises pay attention to?
- PTA 1066 image filtering (15 points)
- PTA 1041 seat number (15 points)
- What is the website domain name and how to register the secondary domain name?
猜你喜欢

How should we learn cloud native in 2022?
Learning routes and materials for cloud native O & M engineers

How does win10 turn off f1~f12 shortcut keys?

Answer questions! This article explains the automated testing framework in software testing from beginning to end
Easy to understand JDBC tutorial - absolutely suitable for zero Foundation

Intensive learning and application of "glory of the king" to complete the application of 7 real worlds other than human players
What cloud native knowledge should programmers master?
随机推荐
Where does the website domain name buy a normal domain name? What is the approximate price
How to create a virtual machine on vSphere client -- a reliable virtual machine creation tutorial
How to buy a domain name? What should I pay attention to when buying a domain name?
PTA 1041 seat number (15 points)
How to apply for a domain name for free? What is the importance of domain names?
What is primary domain name? What are the divisions of domain names
Kubernetes configures two ways of hot update
Micro build low code supports PC application construction
Flutter common development problems
Explain thoroughly and learn rotten binary tree (4): storage structure of binary tree - build heap - Search - sort
Select MySQL database from the command prompt window
5g/4g data acquisition telemetry terminal
What enlightenment does it consulting giant Accenture get from the blackmail attack?
When a beef cow has an "electronic ID card"
IBM v3700 brief configuration process
Oceanus practice - use of the Nepal graph connector in the graph database
Deleting a data table in a command prompt window
[2021 techo youth cloud high-quality course replay, waiting for you to take away]
[competition experience sharing] [Tencent internal track rank6] goose Rose Square half hand (TAS) experience
Bert series Roberta Albert erine detailed explanation and use learning notes