

长按二维码关注
大数据领域必关注的公众号

execution.checkpointing.externalized-checkpoint-retention: RETAIN_ON_CANCELLATIONexecution.checkpointing.max-concurrent-checkpoints: 1execution.checkpointing.mode: EXACTLY_ONCEexecution.checkpointing.timeout: 10minstate.backend: filesystemstate.checkpoints.dir: hdfs://mycluster/flinkcdc-checkpoints
SET 'execution.checkpointing.interval' = '10s';SET 'parallelism.default' = '3';
CREATE TABLE `cars`(`id` BIGINT,`owerId` BIGINT,`carCode` STRING,`carColor` STRING,`type` BIGINT,`remark` STRING,PRIMARY KEY(id) NOT ENFORCED) WITH ('connector' = 'mysql-cdc','hostname' = 'hadoop1','port' = '3306','username' = 'hive','password' = 'hive','database-name' = 'sca','table-name' = 'cars','connect.timeout' = '60s');
CREATE TABLE `cars_copy`(`id` BIGINT,`owerId` BIGINT,`carCode` STRING,`carColor` STRING,`type` BIGINT,`remark` STRING,PRIMARY KEY(id) NOT ENFORCED) WITH ('connector' = 'jdbc','url' = 'jdbc:mysql://hadoop1:3306/sca?useUnicode=true&characterEncoding=utf8','username' = 'hive','password' = 'hive','table-name' = 'cars_copy','sink.parallelism' = '2');
insert into cars_copy SELECT * FROM cars;
select count(*) from cars_copy
insert into `cars` (`id`, `owerId`, `carCode`, `carColor`, `type`, `remark`) values('10096006','10244815','港T·7RONE','红色','1',NULL);insert into `cars` (`id`, `owerId`, `carCode`, `carColor`, `type`, `remark`) values('10096007','10244816','港T·7RONE','黄色','1',NULL);
bin/flink stop --savepointPath hdfs://mycluster/flinkcdc-savepoints -Dyarn.application.id=application_1658045078748_0001 79ce915e39fc1d18a194b6a464d7c3fd
SET 'execution.checkpointing.interval' = '10s';SET 'parallelism.default' = '3';SET 'execution.savepoint.path' = 'hdfs://mycluster/flinkcdc-savepoints/savepoint-79ce91-92206bcaaad2';
insert into cars_copy SELECT * FROM cars;
insert into `cars` (`id`, `owerId`, `carCode`, `carColor`, `type`, `remark`) values('10096008','10244815','港T·7RONE','红色','1',NULL);insert into `cars` (`id`, `owerId`, `carCode`, `carColor`, `type`, `remark`) values('10096009','10244816','港T·7RONE','黄色','1',NULL);
select count(*) from cars_copy
完
文章转载自大数据研习社,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。





