小编Bra*_*don的帖子

S3目录上的Spark流

因此,我有成千上万的事件通过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()
Run Code Online (Sandbox Code Playgroud)

但是,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.
Run Code Online (Sandbox Code Playgroud)

为什么Spark Streaming无法接收新文件?是因为AWS在目录中创建文件而不是移动文件吗?如何确保Spark能够拾取转储到S3中的文件?

scala amazon-s3 amazon-web-services apache-spark spark-streaming

4
推荐指数
1
解决办法
1万
查看次数