当前位置:网站首页>Flink 1.15 implements SQL script to recover data from savepointh
Flink 1.15 implements SQL script to recover data from savepointh
2022-07-27 00:55:00 【One day long -- xuanbin】
flinksql Interface creation table , And write the data to , Reference resources :Flink 1.15 Local cluster deployment Standalone Pattern ( Independent cluster mode )_ One day long -- Hyun Bin's blog -CSDN Blog


After creating the table, execute the following command to automatically create flink job:
INSERT INTO `all_users_sink`(id,user_name,address,phone_number,email,ct_date)
SELECT id,user_name,address,phone_number,email,ct_date FROM user_source;
see job Task list :
./flink-1.15.0/bin/flink list

preservation savepoint
./bin/flink savepoint :jobId [:targetDirectory] -- jobid and savepoint Keep the file directory
./bin/flink savepoint c8fa5a96073d064b0a717590a7029c0d file:///usr/local/flink-1.15.0/flink-savepoints
from savepoint/checkPoint recovery
RESET execution.savepoint.path; -- Reset point Save the path
SET execution.savepoint.path = 'file:///usr/local/flink-1.15.0/flink-savepoints/savepoint-c8fa5a-1161f2626294'; -- Set recovery path

Execute the following command to recover ( Must and create job At the time of the sql Command consistent )
INSERT INTO `all_users_sink`(id,user_name,address,phone_number,email,ct_date)
SELECT id,user_name,address,phone_number,email,ct_date FROM user_source;
If there are any errors reported below ( You can use the following command to ignore the error ):

set 'execution.savepoint.ignore-unclaimed-state' = 'true'; -- Allow skipping savepoint states that cannot be restored
After success, the interface displays :

Cancel the task :
./flink-1.15.0/bin/flink cancel $JOB_ID
./flink-1.15.0/bin/flink cancel c8fa5a96073d064b0a717590a7029c0d
Delete savepoint :
./bin/flink savepoint --dispose Hold point directory $JOB_ID
./bin/flink savepoint --dispose /usr/local/flink-1.15.0/flink-savepoints/savepoint-c8fa5a-1161f2626294 c8fa5a96073d064b0a717590a7029c0d
Stop the job gracefully and create a savepoint :
./bin/flink stop --savepointPath /tmp/flink-savepoints $JOB_ID
./bin/flink stop --savepointPath /usr/local/flink-1.15.0/flink-savepoints 74e0eddfa18eb39c403617f1d573cfdd
flink sql Refer to official documents for commands :SQL Client | Apache Flink
flink adopt jar The job created by the package is restored , Start the job from the savepoint :
Refer to official documentation :Checkpoints | Apache Flink
./bin/flink run --detached --fromSavepoint /usr/local/flink-1.15.0/flink-savepoints/savepoint-74e0ed-e3e4e431bd5d ./examples/streaming/StateMachineExample.jar
边栏推荐
- [CISCN2019 华东南赛区]Double Secret
- [interview: concurrent Article 16: multithreading: detailed explanation of wait/notify] principle and wrong usage (false wake-up, etc.)
- [BJDCTF2020]EzPHP
- [漏洞实战] 逻辑漏洞挖掘
- Flink checkpoint源码理解
- 10 - CentOS 7 上部署MySql
- MYSQL分表DDL操作(存储过程)
- DOM day_01(7.7) dom的介绍和核心操作
- [HFCTF2020]EasyLogin
- Search engine realizes keyword highlighting
猜你喜欢
随机推荐
Parallel MPI program delivery send message
2022.7.10DAY602
forward和redirect的区别
MySQL Article 1
[NCTF2019]SQLi
Spark数据倾斜解决办法
ES6中的export和import
[HarekazeCTF2019]encode_and_encode
DOM day_ 04 (7.12) BOM, open new page (delayed opening), address bar operation, browser information reading, historical operation
6_ Gradient descent method
Flask学习最佳入门指南
[CTF攻防世界] WEB区 关于备份的题目
JSCORE day_05(7.6)
Consistency inspection and evaluation method kappa
Export and import in ES6
Canal 介绍
哪个证券公司开户股票佣金低,哪个股票开户安全
Ah ah ah ah ah a
FlinkSql多表(三表) join/interval join
[b01lers2020]Welcome to Earth



![[CISCN2019 华东南赛区]Double Secret](/img/51/9597968ff1747a67e10a70b785ee9f.png)
![[WUSTCTF2020]CV Maker](/img/64/06023938e83acc832f06733b6c4d63.png)
![[NCTF2019]SQLi](/img/a9/e103ccbbbb7dcf5ed20eb2bada528f.png)
![[leetcode] no duplicate longest string](/img/97/bf8c9b019136ab372ce2c43cddbb2c.jpg)

![[CTF攻防世界] WEB区 关于备份的题目](/img/af/b78eb3522160896d77d9e82f7e7810.png)
![[ciscn2019 North China Day1 web5] cyberpunk](/img/84/b186adc8becfc9b3def7dfd8e4cd41.png)