【发布时间】:2016-08-23 00:39:22
【问题描述】:
我正在集群模式下在 YARN 上运行 Spark Streaming 应用程序,我正在尝试实现正常关闭,以便在应用程序被终止时,它将在停止之前完成当前微批处理的执行。
按照一些教程,我将spark.streaming.stopGracefullyOnShutdown 配置为true,并将以下代码添加到我的应用程序中:
sys.ShutdownHookThread {
log.info("Gracefully stopping Spark Streaming Application")
ssc.stop(true, true)
log.info("Application stopped")
}
但是当我用
杀死应用程序时yarn application -kill application_1454432703118_3558
此时执行的微批处理没有完成。
在驱动程序中,我看到打印的第一行日志(“正常停止 Spark Streaming 应用程序”),但没有看到最后一行(“应用程序停止”)。
ERROR yarn.ApplicationMaster: RECEIVED SIGNAL 15: SIGTERM
INFO streaming.MySparkJob: Gracefully stopping Spark Streaming Application
INFO scheduler.JobGenerator: Stopping JobGenerator gracefully
INFO scheduler.JobGenerator: Waiting for all received blocks to be consumed for job generation
INFO scheduler.JobGenerator: Waited for all received blocks to be consumed for job generation
INFO streaming.StreamingContext: Invoking stop(stopGracefully=true) from shutdown hook
在 executors 日志中,我看到以下错误:
ERROR executor.CoarseGrainedExecutorBackend: Driver 192.168.6.21:49767 disassociated! Shutting down.
INFO storage.DiskBlockManager: Shutdown hook called
WARN remote.ReliableDeliverySupervisor: Association with remote system [akka.tcp://sparkDriver@192.168.6.21:49767] has failed, address is now gated for [5000] ms. Reason: [Disassociated]
INFO util.ShutdownHookManager: Shutdown hook called
我认为问题与 YARN 如何向应用程序发送终止信号有关。关于如何使应用程序正常停止的任何想法?
【问题讨论】:
-
你解决了吗?
-
不,很遗憾没有。
标签: hadoop-yarn spark-streaming