You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 史 正超 <sh...@outlook.com> on 2020/10/30 07:05:38 UTC

回复: flink任务挂掉后自动重启

可以通过使用rest api 定时拉取checkpoints的状态
rest api uri为  {cluster}/jobs/{jobid}/checkpoints

返回的是json,里面有最近一次的ck记录和 历史记录。
________________________________
发件人: bradyMk <zh...@126.com>
发送时间: 2020年10月30日 6:52
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: Re: flink任务挂掉后自动重启

谢谢您的解答~
重启策略确实可以解决任务故障重启,但是有的时候(例如集群资源不够),任务会直接被kill掉,我想问的是针对被kill掉的任务,有没有什么方法可以自动重启,特别是带有ck的任务,如果想要自动重启,如何在启动的时候自动去hdfs上获取最新的ck地址呢?



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
您好,请问每次任务重启后,jm节点是不一样的,你是如何获取到{cluster}的信息的呢?



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
了解了,是我想的太局限了,谢谢zhisheng大佬啦~



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by zhisheng <zh...@gmail.com>.
平台层是将功能自动化,产品化,没有平台总可以手动按照这个思路去实现。

bradyMk <zh...@126.com> 于2020年11月2日周一 下午2:27写道:

> 那我们没有这样的计算平台该怎么办呢?
>
>
>
> -----
> Best Wishes
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
那我们没有这样的计算平台该怎么办呢?



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by zhisheng <zh...@gmail.com>.
平台层的意思就是说:假设你们有实时计算平台,那么可以考虑把这个想法做在你们的平台里面。

bradyMk <zh...@126.com> 于2020年11月2日周一 上午11:40写道:

> zhisheng大佬好~我不是很理解您说的平台层具体是什么意思,指的是什么。。。
>
>
>
> -----
> Best Wishes
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
zhisheng大佬好~我不是很理解您说的平台层具体是什么意思,指的是什么。。。



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
zhisheng大佬好~我不太理解你说的平台层是什么。。。



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/

Re: 回复: flink任务挂掉后自动重启

Posted by zhisheng <zh...@gmail.com>.
hi,

提供一个方案,平台层可以做到作业自动拉起,那么需要平台层有这些信息。

1、作业启动的时候保存一下作业的 jobid 信息

2、平台轮训检测作业的状态,如果作业挂了,直接从配置的 checkpoint 基础路径 + jobid 目录下去找最新的目录(里面含
_metadata)

eg: hdfs:/flink/checkpoints/9b4cddb385b0c5db96b0774769867673/chk-15109

然后平台层将作业从 checkpoint 拉起,当然这个是否自动拉起,拉起的次数可以让用户去选择。

Best!
zhisheng

bradyMk <zh...@126.com> 于2020年10月31日周六 下午4:20写道:

> 好的,我去试试这种方法,感谢~
>
>
>
> -----
> Best Wishes
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>

Re: 回复: flink任务挂掉后自动重启

Posted by bradyMk <zh...@126.com>.
好的,我去试试这种方法,感谢~



-----
Best Wishes
--
Sent from: http://apache-flink.147419.n8.nabble.com/