S3DistCp groupBy 子句的使用
Use of S3DistCp groupBy clause
我必须将文件从一个 s3 存储桶复制到另一个。源存储桶中有很多文件夹,我们只能从每个文件夹中选择一个文件。例如,下面是示例结构-
s3://mysrcbucket/CustomerID1/File1
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File1
s3://mysrcbucket/CustomerID2/File2
s3://mysrcbucket/CustomerID2/File3
我准备了一个清单列表(用于 s3distcp),其中包含我需要为每个客户复制的文件名,例如 -
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File3
由于每个客户只需要复制一个文件,因此目标文件名应转换为相应的客户 ID。像-
Expected Result
s3://mytrgtbucket/CustomerID1 (this will hold the content of file-CustomerID1/File2)
s3://mytrgtbucket/CustomerID2 (this will hold the content of file-CustomerID2/File3)
我在这里使用 groupby 子句,我可以创建带有客户 ID 的文件,但它会创建另一个带有 CustomerID 的文件夹,例如,-
Current Result
s3://mytrgtbucket/CustomerID1/CustomerID1
s3://mytrgtbucket/CustomerID2/CustomerID2.
我使用的命令是-
s3-dist-cp --src=s3://mysrcbucket/ --dest=s3://mytrgtbucket/ --copyFromManifest --previousManifest=s3://mysrcbucket/manifest.gz --groupBy='.*(CustomerID\d)/.*'
是否可以做些什么来实现预期结果,而不是当前结果结果.
我通过修改清单文件使其工作。
早期版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/"}
工作版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/CustomerID1/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/CustomerID2/"}
我必须将文件从一个 s3 存储桶复制到另一个。源存储桶中有很多文件夹,我们只能从每个文件夹中选择一个文件。例如,下面是示例结构-
s3://mysrcbucket/CustomerID1/File1
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File1
s3://mysrcbucket/CustomerID2/File2
s3://mysrcbucket/CustomerID2/File3
我准备了一个清单列表(用于 s3distcp),其中包含我需要为每个客户复制的文件名,例如 -
s3://mysrcbucket/CustomerID1/File2
s3://mysrcbucket/CustomerID2/File3
由于每个客户只需要复制一个文件,因此目标文件名应转换为相应的客户 ID。像-
Expected Result
s3://mytrgtbucket/CustomerID1 (this will hold the content of file-CustomerID1/File2)
s3://mytrgtbucket/CustomerID2 (this will hold the content of file-CustomerID2/File3)
我在这里使用 groupby 子句,我可以创建带有客户 ID 的文件,但它会创建另一个带有 CustomerID 的文件夹,例如,-
Current Result
s3://mytrgtbucket/CustomerID1/CustomerID1
s3://mytrgtbucket/CustomerID2/CustomerID2.
我使用的命令是-
s3-dist-cp --src=s3://mysrcbucket/ --dest=s3://mytrgtbucket/ --copyFromManifest --previousManifest=s3://mysrcbucket/manifest.gz --groupBy='.*(CustomerID\d)/.*'
是否可以做些什么来实现预期结果,而不是当前结果结果.
我通过修改清单文件使其工作。
早期版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/"}
工作版本-
{"path":"s3://mytrgtbucket/CustomerID1/File2.txt","srcDir":"s3://mytrgtbucket/CustomerID1/"}
{"path":"s3://mytrgtbucket/CustomerID2/File3.txt","srcDir":"s3://mytrgtbucket/CustomerID2/"}