当前位置:网站首页>Flink 1.15实现 Sql 脚本从savepointh恢复数据
Flink 1.15实现 Sql 脚本从savepointh恢复数据
2022-07-26 22:39:00 【天一道长--玄彬】
flinksql界面创建表,并把数据写入,参考:Flink 1.15本地集群部署Standalone模式(独立集群模式)_天一道长--玄彬的博客-CSDN博客


创建表结束后执行以下命令会自动创建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;
查看job任务列表:
./flink-1.15.0/bin/flink list

保存savepoint
./bin/flink savepoint :jobId [:targetDirectory] -- jobid 和savepoint保持文件目录
./bin/flink savepoint c8fa5a96073d064b0a717590a7029c0d file:///usr/local/flink-1.15.0/flink-savepoints
从savepoint/checkPoint恢复
RESET execution.savepoint.path; -- 重置point保存路径
SET execution.savepoint.path = 'file:///usr/local/flink-1.15.0/flink-savepoints/savepoint-c8fa5a-1161f2626294'; -- 设置恢复路径

在执行以下命令就可以恢复(必须和创建job时的sql命令一致)
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;
如果有以下报错(可以用以下命令忽略报错):

set 'execution.savepoint.ignore-unclaimed-state' = 'true'; --允许跳过无法还原的保存点状态
成功之后的界面显示:

取消任务:
./flink-1.15.0/bin/flink cancel $JOB_ID
./flink-1.15.0/bin/flink cancel c8fa5a96073d064b0a717590a7029c0d
删除保存点:
./bin/flink savepoint --dispose 保持点目录 $JOB_ID
./bin/flink savepoint --dispose /usr/local/flink-1.15.0/flink-savepoints/savepoint-c8fa5a-1161f2626294 c8fa5a96073d064b0a717590a7029c0d
优雅的停止作业并创建保存点:
./bin/flink stop --savepointPath /tmp/flink-savepoints $JOB_ID
./bin/flink stop --savepointPath /usr/local/flink-1.15.0/flink-savepoints 74e0eddfa18eb39c403617f1d573cfdd
flink sql命令参考官方文档:SQL Client | Apache Flink
flink 通过jar包创建的作业恢复,从保存点启动作业:
参考官方文档:Checkpoints | Apache Flink
./bin/flink run --detached --fromSavepoint /usr/local/flink-1.15.0/flink-savepoints/savepoint-74e0ed-e3e4e431bd5d ./examples/streaming/StateMachineExample.jar
边栏推荐
- Medical data of more than 4000 people has been exposed for 16 years
- Parallel MPI program delivery send message
- logback自定义MessageConverter
- DOM day_ 03 (7.11) event bubbling mechanism, event delegation, to-do items, block default events, mouse coordinates, page scrolling events, create DOM elements, DOM encapsulation operations
- [Network Research Institute] attackers scan 1.6 million WordPress websites to find vulnerable plug-ins
- Search engine realizes keyword highlighting
- [CTF攻防世界] WEB区 关于Cookie的题目
- 重学JSON.stringify
- Consistency inspection and evaluation method kappa
- [2. TMUX operation]
猜你喜欢
![[BJDCTF2020]EzPHP](/img/be/a48a1a9147f1f3b21ef2d60fc1f59f.png)
[BJDCTF2020]EzPHP

The company gave how to use the IP address (detailed version)

Install redis-7.0.4 in Linux system
![[By Pass] WAF 的绕过方式](/img/dd/7204b2401a9f18c02c8b9897258905.png)
[By Pass] WAF 的绕过方式

2020-12-20 九九乘法表
![[CTF 真题] 2018-网鼎杯-Web-Unfinish](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[CTF 真题] 2018-网鼎杯-Web-Unfinish

【 Educational Codeforces Round 132 (Rated for Div. 2) A·B·C】

JSCORE day_01(6.30) RegExp 、 Function

【 Educational Codeforces Round 132 (Rated for Div. 2) A·B·C】
![[CISCN2019 华北赛区 Day1 Web5]CyberPunk](/img/84/b186adc8becfc9b3def7dfd8e4cd41.png)
[CISCN2019 华北赛区 Day1 Web5]CyberPunk
随机推荐
A simple prime number program. Beginners hope that older bosses can have a look
[HFCTF2020]EasyLogin
【Codeforces Round #807 (Div 2.) A·B·C】
[leetcode] no duplicate longest string
2022.7.14DAY604
[hongminggu CTF 2021] write_ shell
[4.1 prime number and linear sieve]
Blue Bridge Cup 1004 [recursive] cow story
[ciscn2019 finals Day2 web1]easyweb
[WUSTCTF2020]CV Maker
JSCORE day_03(7.4)
Leetcode 302 weekly games
[4.10 detailed explanation of game theory]
JS screen detection method summary 2021-10-05
[漏洞实战] 逻辑漏洞挖掘
Apply with new, delete and malloc, free to free the heap space
2020-12-22最大公因数
[WUSTCTF2020]CV Maker
DOM day_02(7.8)网页制作流程、图片src属性、轮播图、自定义属性、标签栏、输入框事件、勾选操作、访问器语法
Crop TIF image