s3-dist-cp group使用hadoop distcp命令在Dataproc上等效

问题描述 投票:1回答:1

在EMR上,我使用s3-dist-cp --groupBy将文件夹中的随机fileName命名为一个名称,我希望在S3中将其重命名为:

s3-dist-cp --groupBy='.*(folder_in_hdfs).*' --src=hdfs:///user/testUser/tmp-location/folder_in_hdfs --dest=s3://testLocation/folder_in_s3

例:

hadoop fs -ls hdfs:///user/testUser/tmp-location/folder_in_hdfs
Found 2 items
-rw-r--r--   1 hadoop hadoop          0 2019-04-05 14:54 hdfs:///user/testUser/tmp-location/folder_in_hdfs/file.csv/_SUCCESS
-rw-r--r--   1 hadoop hadoop     493077 2019-04-05 14:54 hdfs:///user/testUser/tmp-location/folder_in_hdfs/file.csv/part-00000-12db8851-31be-4b08-8a93-1887e534941d-c000.csv

运行s3-dist-cp后,

aws s3 ls s3://testLocation/folder_in_s3/
s3://testLocation/folder_in_s3/file.csv

但是,我想使用hadoop distcp命令在Dataproc上实现此功能,并将文件写入GCS位置gs://testLocation/folder_in_gs/file.csv

任何帮助表示赞赏。

hadoop google-cloud-dataproc distcp s3distcp
1个回答
1
投票

Dataproc在DistCp中没有此功能。

也就是说,在运行DistCp后,使用gsutil compose的简单bash脚本实现相同的结果是微不足道的:

DESTINATION=gs://bucket/path/to/destination/file
FILES=($(gsutil ls gs://testLocation/**folder_in_gs**))
gsutil compose "${FILES[@]::32}" "${DESTINATION}"
echo "${FILES[@]:32}"| xargs -n 1 | xargs -i gsutil compose "${DESTINATION}" {} "${DESTINATION}"
gsutil -m rm gs://testLocation/**folder_in_gs**
© www.soinside.com 2019 - 2024. All rights reserved.