未设置 Apache Spark 检查点目录

Apache Spark Checkpoint Directory is not set

在使用 apache-spark 时,我试图对某些流数据应用 "reduceByKeyAndWindow()" 转换,但出现以下错误:

pyspark.sql.utils.IllegalArgumentException: requirement failed: The checkpoint directory has not been set. Please set it by StreamingContext.checkpoint().

是否需要设置检查点目录?

如果是,设置一个最简单的方法是什么?

是的,有必要。 必须为具有以下任何要求的应用程序启用检查点:

状态转换的使用 - 如果在应用程序中使用 updateStateByKey 或 reduceByKeyAndWindow(具有反函数),则必须提供检查点目录以允许定期 RDD 检查点。

从驱动程序故障中恢复 运行 应用程序 - 元数据检查点用于使用进度信息进行恢复。 您可以使用 sc.checkpoint(checkpointDirectoryLocation)

设置检查点目录

http://spark.apache.org/docs/latest/streaming-programming-guide.html#checkpointing