【问题标题】:Swisscom Appcloud S3 Connection reset by peer对等方重置 Swisscom Appcloud S3 连接
【发布时间】:2017-07-06 17:55:14
【问题描述】:

我们有一个使用 Swisscom AppCloud 的 S3 解决方案的 Django Web 服务。到目前为止,我们没有任何问题,但是在尝试上传文件时,我们在应用程序上没有更改任何内容时遇到ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer')) 错误。我们正在使用boto3 1.4.4

编辑:

错误发生在 10 到 30 秒之间。当我在本地开发机器上尝试时,它可以工作。

from django.conf import settings
from boto3 import session
from botocore.exceptions import ClientError

class S3Client(object):

    def __init__(self):
        s3_session = session.Session()

        self.s3_client = s3_session.client(
            service_name='s3',
            aws_access_key_id=settings.AWS_ACCESS_KEY,
            aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
            endpoint_url=settings.S3_ENDPOINT,
        )

    .
    .
    .

    def add_file(self, bucket, fileobj, file_name):
        self.s3_client.upload_fileobj(fileobj, bucket, file_name)

        url = self.s3_client.generate_presigned_url(
            ClientMethod='get_object',
            Params={
                'Bucket': bucket,
                'Key': file_name
            },
            ExpiresIn=60*24*356*10  # signed for 10 years. Should be enough..
        )

        url, signature = self._split_signed_url(url)

        return url, signature, file_name

这可能是版本问题还是我们这边的其他问题?

编辑: 使用s3cmd 进行了一些测试:我可以列出我可以访问的存储桶,但是对于所有其他命令,例如列出所有对象或仅列出存储桶中的对象,我会得到Retrying failed request: / ([Errno 54] Connection reset by peer)

【问题讨论】:

  • 您要上传的文件大小是多少?
  • @dentemm 我尝试使用

标签: django python-2.7 amazon-s3 boto3 swisscomdev


【解决方案1】:

经过一番调查,我发现了错误:

Swisscom 的 S3 实施在某种程度上与 Amazon 的不同。为了解决这个问题,我不得不将botocore1.5.78 降级为1.5.62

【讨论】:

  • 目前我们提供 EMC Atmos en.wikipedia.org/wiki/EMC_Atmos。遗憾的是,这个存储盒与 Amazon S3 不太兼容。开发人员给出了相当多的负面反馈。我们目前正在开发更符合 S3 标准的 EMC ECS 集成en.wikipedia.org/wiki/EMC_Elastic_Cloud_Storage。所以等待几个月,你会看到改进。 S3 是行业标准,但未开放或记录在 RFC 中。存储供应商需要对 Amazon S3 实施进行逆向工程。 Amazon S3 以高速发展。
猜你喜欢
  • 1970-01-01
  • 2019-10-11
  • 2013-09-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多