[英]copy csv files from azure blob storage A to azure blob storage B
[英]Efficiently copy data from Azure blob storage to S3
我想将约100万个文件从Azure存储移动到S3。 我使用Azure python sdk和boto3编写了此python脚本。
marker = None
while True:
batch = azure_blob_service.list_blobs(
container, marker=marker)
# copy blobs in batches
for blob in batch:
blob_name = blob.name
current_blob = azure_blob_service.get_blob_to_bytes(
copy_from_container, blob_name)
s3_client.put_object(
Body=current_blob.content,
Bucket=s3_bucket,
ContentType=current_blob.properties.content_settings.content_type,
Key=blob_name)
if not batch.next_marker:
break
marker = batch.next_marker
但这很慢。
如何有效地将数据从Azure迁移到S3?
考虑到S3不像Azure Blob存储那样支持服务器端异步复制Blob,为了将数据从Azure存储移动到S3,您需要首先从Azure存储下载Blob,然后将它们上传回S3。 在您下载和上传大量数据时,这就是Internet速度发挥作用的地方。
如果要加快整个过程,一种替代方法是在Amazon本身的VM中(最好与S3帐户位于同一区域)在VM中运行此脚本。 这样,您将能够更快地下载(假设Amazon提供的Internet速度比您目前拥有的Internet速度更好),然后可以更快地上传它,并且您将在同一区域中上传。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.