分享

spark streaming程序运行一段时间挂了,如何自动启动

zstu 发表于 2017-2-27 18:56:03 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 3 23406
spark streaming程序运行一段时间后,出了异常导致程序挂了,如何自动启动streaming程序。

已有(3)人评论

跳转到指定楼层
langke93 发表于 2017-2-27 20:11:17
自动启动,这个比较麻烦的,除非做一个守护进程。但是需要懂shell等知识。
最好找到错误原因。防止挂掉
回复

使用道具 举报

哈根达斯 发表于 2017-4-21 11:07:11
写个监控脚本,挂了就重启
回复

使用道具 举报

howtodown 发表于 2017-4-21 13:27:44
Spark-Streaming容错机制可以自动重启的:

启动Driver自动重启(ClusterManager支持该功能)
standalone: 提交任务时添加 --supervise 参数
官方文档链接

yarn:设置yarn.resourcemanager.am.max-attempts 或者spark.yarn.maxAppAttempts
spark on yarn参数配置
mesos: 提交任务时添加 --supervise 参数



设置checkpoint

StreamingContext.setCheckpoint(hdfsDirectory)

支持从checkpoint中重启

[mw_shl_code=scala,true]def createContext(checkpointDirectory: String): StreamingContext = {
val ssc = ???
ssc.checkpoint(checkpointDirectory)
ssc
}
val ssc = StreamingContext.getOrCreate(checkpointDirectory, createContext(checkpointDirectory))[/mw_shl_code]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条