未设置Apache Spark Checkpoint目录

Sac*_*hin 2 streaming apache-spark pyspark

在使用apache-spark时,我试图在某些流数据上应用"reduceByKeyAndWindow()"转换,并收到以下错误:

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

是否有必要设置检查点目录?

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

mor*_*002 7

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

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

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

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