将Kafka与具有不同目录结构的aws s3同步
Syncing Kafka with aws s3 with different directory structure
我们有事件传到 Kafka,我们使用 kafka connect 将这些事件与 aws s3 同步。
数据在 s3 中的以下目录结构中可见:
bucket_name/sub_folder/
Partition=0/events.json
Partition=1/events.json
Partition=2/events.json
有没有办法存储在下面的目录结构中:
Bucket_name/sub_folder/date=today_date/ events.json or Partition=0..2/date=today/events.json
Bucket_name/sub_folder/date=today_date/ events.json or
动机是将那天的事件存储在那天的目录中,我在网上搜索但找不到任何其他方式。
提前致谢。
您可以使用 TimeBasedPartitioner
其中
partitions data according to ingestion time.
例如每小时分区:
[…]
"partitioner.class": "io.confluent.connect.storage.partitioner.TimeBasedPartitioner",
"path.format": "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH",
"locale": "US",
"timezone": "UTC",
"partition.duration.ms": "3600000",
"timestamp.extractor": "RecordField",
"timestamp.field": "my_record_field_with_timestamp_in",
[…]
我们有事件传到 Kafka,我们使用 kafka connect 将这些事件与 aws s3 同步。 数据在 s3 中的以下目录结构中可见:
bucket_name/sub_folder/
Partition=0/events.json
Partition=1/events.json
Partition=2/events.json
有没有办法存储在下面的目录结构中:
Bucket_name/sub_folder/date=today_date/ events.json or Partition=0..2/date=today/events.json
Bucket_name/sub_folder/date=today_date/ events.json or
动机是将那天的事件存储在那天的目录中,我在网上搜索但找不到任何其他方式。 提前致谢。
您可以使用 TimeBasedPartitioner
其中
partitions data according to ingestion time.
例如每小时分区:
[…]
"partitioner.class": "io.confluent.connect.storage.partitioner.TimeBasedPartitioner",
"path.format": "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH",
"locale": "US",
"timezone": "UTC",
"partition.duration.ms": "3600000",
"timestamp.extractor": "RecordField",
"timestamp.field": "my_record_field_with_timestamp_in",
[…]