Spark Streaming On Yarn/ On StandAlone模式下的checkpointing容错
来源:互联网 发布:python 写入环境变量 编辑:程序博客网 时间:2024/04/30 05:46
Spark On Yarn:
在Spark On Yarn模式下部署Spark Streaming 时候,我们需要使用StreamingContext.getOrCreate方法创建StreamingContext实例,指定我们自己的checkpoint目录,用作存储checkpoint数据。
容错1:
当我们使用spark-submit成功提交一个程序之后,我们可以使用jps能够查看到CoarseGrainedExecutorBackend进程,当我们直接kill该线程时候,你会发现立马会再次启动一个全新的CoarseGrainedExecutorBackend进行,这个就是Yarn提供的特性支持自动重启容错,重启的CoarseGrainedExecutorBackend会去读取checkpoint中的数据然后继续计算。
容错2:
如果我们使用yarn application -kill jobid 直接杀死作业的话,再次启动你会发现程序启动不起来了。直接抛异常:
Exception in thread "main" org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:85)at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:62)
异常信息也很清晰:Yarn application has already ended! It might have been killed or unable to launch application master. 为了确定该问题只好翻阅源码看问题具体原因,查看YarnClientSchedulerBackend的waitForApplication方法:
/** * Report the state of the application until it is running. * If the application has finished, failed or been killed in the process, throw an exception. * This assumes both `client` and `appId` have already been set. */ private def waitForApplication(): Unit = { assert(client != null && appId.isDefined, "Application has not been submitted yet!") val (state, _) = client.monitorApplication(appId.get, returnOnRunning = true) // blocking if (state == YarnApplicationState.FINISHED || //判断如果是完成或者失败或者杀死的话 直接抛异常 state == YarnApplicationState.FAILED || state == YarnApplicationState.KILLED) { throw new SparkException("Yarn application has already ended! " + "It might have been killed or unable to launch application master.") } if (state == YarnApplicationState.RUNNING) { logInfo(s"Application ${appId.get} has started running.") } }通过代码猜测,Spark 设计者的想法是:如果程序异常被杀死某一个进行的话,则又Yarn负责自动重启容错,就如上面容错问题1描述。如果是人为kill,或者执行完毕,或者失败的话,则认为程序本身要么是执行完毕不需要再次运行,要么认为程序有错误不需要再次执行。
所以on yarn的容错是由yarn负责的。
拓展:由于yarn不允许我们重启提交作业从checkpoint中恢复的话,那么如果我们stareaming消费kafka的话,就需要手动完成kafka的消费offset的自行保存,一遍加载启动时候能够继续消费。
Spark On StandAlone:
如果是spark standlone模式提交的话,如果直接在webui上面kill该job的话,会从新加载上次的checkpoint目录完成容错。
spark standlone模式下,也支持kill CoarseGrainedExecutorBackend之后自动重启CoarseGrainedExecutorBackend的。
结论:不同的部署模式容错有差异,还需要视具体情况而定。
- Spark Streaming On Yarn/ On StandAlone模式下的checkpointing容错
- spark standalone模式作业迁移到spark on yarn
- spark on yarn模式下扫描带有kerberos的hbase
- Spark On YARN部署模式下的内存分配情况
- spark on yarn 的运行模式
- Stop Spark Streaming On YARN Gracefully
- spark standalone&&yarn模式
- Spark Standalone与Spark on YARN的几种提交方式
- Spark1.0.x入门指南(spark on yarn, standalone)
- spark 1.X standalone和on yarn安装配置
- spark on yarn的理解
- spark on yarn 的安装
- Spark Streaming: checkpointing 小节
- Apache Spark源码走读之15 -- Standalone部署模式下的容错性分析
- 分析spark on yarn cluster 与 client 模式的区别
- spark on yarn cluster 与 client 模式的区别
- Spark on yarn和Hadoop on yarn的区别
- sparkR在spark on yarn下的问题
- linux shell 关闭 端口 对应的 进程
- 【PDF下载】大数据峰会之MaxCompute大数据语言的新发展
- 短暂的旅程或许也是一种人生
- Modify批量处理优化
- framebuffer缓冲帧/dev/fb0学习
- Spark Streaming On Yarn/ On StandAlone模式下的checkpointing容错
- Python实现亚马逊网站图书满减信息的微信通知
- mina框架入门
- MFC中字符间相互转换总结
- 101. Symmetric Tree
- AIDL的简单使用,涵盖5.0之后系统及魅族手机调用问题的解决
- 操作EXCEL报错检索COM类工厂中CLSID为{00024500-0000-0000-C000-000000000046}的组件时失败,原因是出现以下错误: 8000401a
- android AsyncTask介绍
- Tensorflow 线性回归预测房价实例