复制正在更新的天蓝色Blob [英] Copying azure blob that is being updated

查看:44
本文介绍了复制正在更新的天蓝色Blob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Start-AzureStorageBlobCopy将blob及其关联的快照从一个Azure存储帐户复制到另一个帐户:

I'm copying a blob and its associated snapshots from one Azure storage account to another, using Start-AzureStorageBlobCopy:

$status = Start-AzureStorageBlobCopy -SrcContainer $container -SrcBlob $blob 
  -SrcContext $srccontext -DestContainer $container 
  -DestBlob $blob -DestContext $destContext -Force

但是,当另一个应用程序更新blob时,复制操作将失败.

However, when another application updates the blob, the copy operation fails.

$copyState = $status | Get-AzureStorageBlobCopyState 
$copyState.Status -eq "Failed"

在更新Blob时,是否可以复制Blob或其快照之一?

Is there a way to copy a blob or one of its snapshots while the blob is being updated?

推荐答案

在此

In this MSDN article, the topic of async blob copy is discussed in detail. In particular, it discusses how the copy operation locks onto the blob's ETag, and if the ETag changes (e.g. you changed the blob), the copy fails.

为避免这种情况,该文章建议在Blob上获得租约.

To avoid this, the article suggests getting a lease on the blob.

您可以做的另一件事是将快照复制到新的blob,因为不会修改快照.

The other thing you can do is copy a snapshot to a new blob, as a snapshot won't be modified.

这篇关于复制正在更新的天蓝色Blob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆