Write pubsub data to gcs through dataflow

2019-08-17 07:27发布

I would like to consume data from pubsub through dataflow streaming job and store it into GCS in hourly directories.

What would be best approach?

I tried using WindowedFilenamePolicy but it adds an additional group by and slows down the write operation at the time of writes. Dataflow buffers the data correctly but takes too long to write data in temp bucket.

Any best practice for such fairly common case?

Regards, Pari

1条回答
何必那么认真
2楼-- · 2019-08-17 08:22

Using the Google-Provided Dataflow Template for the streaming pipeline from Cloud Pub/Sub to Google Cloud Storage files, you can easily do it by setting the outputDirectory to gs://<BUCKET>/YYYY/MM/DD/HH/ and it will automatically replace YYYY, MM, DD and HH for the values of the interval window.

查看更多
登录 后发表回答