【发布时间】:2020-02-28 06:31:18
【问题描述】:
我们目前正在开发一个 Apache Beam 管道,用于从 GCP Pub/Sub 读取数据并将接收到的数据写入 AWS S3 中的存储桶。
我们在beam-sdks-java-io.amazon-web-services 中使用TextIO.write 写入S3。
TextIO.write()
.withWindowedWrites()
.withNumShards(options.getNumShards)
.withTempDirectory(FileBasedSink.convertToFileResourceIfPossible(options.getTempLocation))
.to(FileBasedSink.convertToFileResourceIfPossible(options.getOutputDirectory))
所以首先我们使用DirectRunner 在本地测试了这个管道,并且效果很好。 (从 Pub/Sub 传入的数据被管道接收并写入 S3。
options.setRunner(classOf[DirectRunner])
options.setStagingLocation("./outputFolder/staging")
options.setTempLocation("s3://my-s3-bucket/temp")
options.setOutputDirectory("s3://my-s3-bucket/output")
在上一部分中,我们希望使用 Dataflow runner 运行此管道,而无需更改任何代码,因此我们修改了代码以使用 DataflowRunner
options.setRunner(classOf[DataflowRunner])
options.setStagingLocation("gs://my-gcs-bucket/binaries")
options.setGcpTempLocation("gs://my-gcs-bucket/temp")
options.setTempLocation("s3://my-s3-bucket/temp")
options.setOutputDirectory("s3://my-s3-bucket/output")
使用此设置,管道会从 pub/sub 接收数据,但不会写入 S3。 StackDriver 中的数据流日志也没有写入任何错误。
有谁知道可能是什么问题?管道选项配置是否不正确?还是对 S3 的写入静默失败?
有没有人建议如何在beam-sdks-java-io.amazon-web-services 中配置日志以输出 DEBUG 级别的日志记录?
谢谢!
【问题讨论】:
标签: java google-cloud-dataflow apache-beam apache-beam-io