【发布时间】:2015-09-08 18:10:53
【问题描述】:
因此,我有数千个事件通过 Amazon Kinesis 流式传输到 SQS,然后转储到 S3 目录中。大约每 10 分钟创建一个新的文本文件,以将 Kinesis 中的数据转储到 S3。我想设置 Spark Streaming,以便将转储到 S3 的新文件流式传输。现在我有
import org.apache.spark.streaming._
val currentFileStream = ssc.textFileStream("s3://bucket/directory/event_name=accepted/")
currentFileStream.print
ssc.start()
但是,Spark Streaming 不会提取转储到 S3 中的新文件。我认为这与文件写入要求有关:
The files must have the same data format.
The files must be created in the dataDirectory by atomically moving or renaming them into the data directory.
Once moved, the files must not be changed. So if the files are being continuously appended, the new data will not be read.
为什么 Spark 流式传输不获取新文件?是因为 AWS 在目录中创建文件而不是移动它们吗?如何确保 Spark 拾取转储到 S3 中的文件?
【问题讨论】:
-
你能分享你设置s3相关配置的代码吗?
标签: scala amazon-web-services amazon-s3 apache-spark spark-streaming