CREATE TABLE `source_1`(`f_sequence` INT,`f_random` INT,`f_random_str` VARCHAR,PRIMARY KEY (`f_sequence`) NOT ENFORCED) WITH ('connector' = 'mysql-cdc' ,'hostname' = 'ip1','port' = '3306','username' = 'xxx','password' = 'xxx','database-name' = 'db1','table-name' = 'source_1');CREATE TABLE `source_2`(`f_sequence` INT,`f_random` INT,`f_random_1` INT,`f_random_str` VARCHAR,`f_random_str_1` VARCHAR,PRIMARY KEY (`f_sequence`) NOT ENFORCED) WITH ('connector' = 'mysql-cdc' ,'hostname' = 'ip1','port' = '3306','username' = 'xxx','password' = 'xxx','database-name' = 'db2','table-name' = 'source_2');CREATE TABLE `sink_1`(`f_sequence` INT,`f_random` INT,`f_random_str` VARCHAR,PRIMARY KEY (`f_sequence`) NOT ENFORCED) WITH ('connector' = 'logger');CREATE TABLE `sink_2`(`f_sequence` INT,`f_random` INT,`f_random_1` INT,`f_random_str` VARCHAR,`f_random_str_1` VARCHAR,PRIMARY KEY (`f_sequence`) NOT ENFORCED) WITH ('connector' = 'logger');insert into sink_1 select * from source_1;insert into sink_2 select * from source_2;
SET table.optimizer.mysql-cdc-source.merge.enabled=true;
Option | Default Value | Description |
table.optimizer.mysql-cdc-source.merge.enabled | false | Whether to enable merging of MySQL sources. If it is enabled, Stream Compute Service will automatically merge MySQL CDC sources that belong to the same database in a job into one source. |
table.optimizer.mysql-cdc-source.merge.default-group.splits | 1 | The number of sources multiple MySQL CDC sources are merged into (when merging is enabled). If there is a large number of tables, merging them all into one source may not meet performance requirements. In such cases, you can increase the value of this parameter. Stream Compute Service will group the sources as evenly as possible according to the parameter specified. |
source_1
, source_2
, source_3
, and source_4
are MySQL CDC sources from the same database instance (source and sink definitions are omitted). You can use the following SET command to configure the source merging feature.SET table.optimizer.mysql-cdc-source.merge.enabled=true;SET table.optimizer.mysql-cdc-source.merge.default-group.splits=2;insert into sink_1 select * from source_1;insert into sink_2 select * from source_2;insert into sink_3 select * from source_3;insert into sink_4 select * from source_4;
Was this page helpful?