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

将 Blob 上传到 Azure Blob 存储

如何解决将 Blob 上传到 Azure Blob 存储

我正在尝试在 azure blob 存储中上传 blob,但出现 ECONNREFUSED 错误

我应该怎么做才能在端口中建立连接。 当我尝试使用 Azure 存储资源管理器打开它时,它显示了同样的错误

我已经检查了 python 依赖项并且版本是最新的。 操作系统 = Ubuntu 18.04

我的连接字符串类似于

"DefaultEndpointsProtocol=http;AccountName=local;AccountKey=<KEY>;BlobEndpoint=http://<SYstem_IP>:11002/local;"

代码-

blob = BlobClient.from_connection_string(conn_str=blob_conn_str,\
                        container_name=container_name,\
                        blob_name=blob_name)
                        
                blob.upload_blob(data)
                print("Uploaded to blob: %s" % blob_name)
                print("Processed message..\n\n")

日志-

INFO:azure.core.pipeline.policies.http_logging_policy:Request method: 'PUT'
INFO:azure.core.pipeline.policies.http_logging_policy:Request headers:
INFO:azure.core.pipeline.policies.http_logging_policy:    'x-ms-blob-type': 'REDACTED'
INFO:azure.core.pipeline.policies.http_logging_policy:    'Content-Length': '331350'
INFO:azure.core.pipeline.policies.http_logging_policy:    'if-none-match': '*'
INFO:azure.core.pipeline.policies.http_logging_policy:    'x-ms-version': 'REDACTED'
INFO:azure.core.pipeline.policies.http_logging_policy:    'Content-Type': 'application/octet-stream'
INFO:azure.core.pipeline.policies.http_logging_policy:    'Accept': 'application/xml'
INFO:azure.core.pipeline.policies.http_logging_policy:    'User-Agent': 'azsdk-python-storage-blob/12.8.1 Python/3.6.9 (Linux-5.4.0-73-generic-x86_64-with-ubuntu-18.04-bionic)'
INFO:azure.core.pipeline.policies.http_logging_policy:    'x-ms-date': 'REDACTED'
INFO:azure.core.pipeline.policies.http_logging_policy:    'x-ms-client-request-id': '1b3784d4-b7b9-11eb-887c-0c7a15549246'
INFO:azure.core.pipeline.policies.http_logging_policy:    'Authorization': 'REDACTED'
INFO:azure.core.pipeline.policies.http_logging_policy:A body is sent with the request
DEBUG:urllib3.connectionpool:Starting new HTTP connection (4): <SYstem IP>:11002
Unexpected error 
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py",line 916,in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py",line 864,in run
    self._target(*self._args,**self._kwargs)
  File "main.py",line 329,in thread_runner
    fps_app.eisSubscriber()
  File "main.py",line 272,in eisSubscriber
    upload_blob_content(blob_conn_str,blob3,blob_name_top)
  File "main.py",line 205,in upload_blob_content
    blob.upload_blob(data)
  File "/usr/local/lib/python3.6/dist-packages/azure/core/tracing/decorator.py",line 83,in wrapper_use_tracer
    return func(*args,**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_blob_client.py",line 693,in upload_blob
    return upload_block_blob(**options)
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_upload_helpers.py",line 105,in upload_block_blob
    **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_generated/operations/_block_blob_operations.py",line 224,in upload
    pipeline_response = self._client._pipeline.run(request,stream=False,**kwargs)
  File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py",line 211,in run
    return first_node.send(pipeline_request)  # type: ignore
  File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py",line 71,in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/_base.py",in send
    response = self.next.send(request)
  [PrevIoUs line repeated 2 more times]
  File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/policies/_redirect.py",line 158,in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_shared/policies.py",line 515,in send
    raise err
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_shared/policies.py",line 489,in send
    response = self.next.send(request)
  [PrevIoUs line repeated 1 more time]
  File "/usr/local/lib/python3.6/dist-packages/azure/storage/blob/_shared/policies.py",line 290,line 103,in send
    self._sender.send(request.HTTP_Request,**request.context.options),File "/usr/local/lib/python3.6/dist-packages/azure/core/pipeline/transport/_requests_basic.py",line 291,in send
    raise error
**azure.core.exceptions.ServiceRequestError: <urllib3.connection.httpconnection object at 0x7fcdc1fd66a0>: Failed to establish a new connection: [Errno 111] Connection refused**

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