微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Azure blob 存储未存储在本地

如何解决Azure blob 存储未存储在本地

我想使用 azure-blob-storage 容器将数据存储在本地目录中。为此,我使用了另一个容器中的 upload_blob。该文件正在上传到云端,但未存储在本地路径中。我已经提供了绑定、设备到云上传属性,并使用“chmod 777”更改了目录的权限。完成所有这些后,文件不会保存在本地。
Python函数

with blob_service_client.get_blob_client(container=container_name,blob=local_file_name) as upload_client:
 with open(upload_file_path,"rb") as data:
     print("Uploading the file")
     upload_client.upload_blob(data,blob_type="BlockBlob",overwrite=True)
     print("Finished uploading")
     

绑定:

"HostConfig": {
       "Binds": [
           "/opt/localstorage/blob/:/blobroot"
       ]

上传属性

"blobstorage": {
   "properties.desired": {
     "devicetoCloudUploadProperties": {
       "uploadOn": true,"uploadOrder": "NewestFirst","cloudStorageConnectionString": "xxxx"
       "storageContainersForUpload": {
         "bloboutput": {
           "target": "bloboutput"
         }
       }
     },"deviceAutoDeleteProperties": {
       "deleteOn": false,"deleteAfterMinutes": 15
     }

日志:

     [2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Successfully loaded {0}: {1},p0="Nephos.MaskClientIPAddressesInLogs",p1="False"
 [2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Loading config Param {0} ({1}) read: {2},p0="NephosIncludeInternalDetailsInErrorResponses",p1="Include internal details in error responses",p2="true"
 [2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Successfully loaded {0}: {1},p1="True"
 [2021-04-20 04:23:57.857] [info    ] [tid 1] Info: Loading config Param {0} ({1}) read: {2},p0="StampName",p1="Stamp Name",p2="Default Stamp"
 [2021-04-20 04:23:57.924] [info    ] [tid 1] Microsoft.AzureStack.Services.Storage.EntryPoint.BlobService: BlobService - StartAsync completed
 [2021-04-20 04:23:57.925] [info    ] [tid 1] Microsoft.Azure.Devices.BlobStorage.Tiering.BlobTieringService: Starting service...
 [2021-04-20 04:23:57.937] [info    ] [tid 1] [BlobInterface.cc:1494] [ListBlobsInorder] ListBlobsInorder received. Container:bloboutput BlobNameStart:null MaxBlobNames:1 OrderType:1 Flags:1
 [2021-04-20 04:23:57.937] [error   ] [tid 1] [metastore.cc:1953] [ListBlobsInorder] Container not found. Name:bloboutput

解决方法

因为您提到在“本地”存储文件。那么你应该使用方法'download_blob'

这是tutorials

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。