【问题标题】:Uploading Binary File to Openstack Swift Gives Error将二进制文件上传到 Openstack Swift 会出错
【发布时间】:2017-06-14 20:17:43
【问题描述】:

我正在尝试将我必须的二进制文件上传到 Openstack Swift。此文件的大小为 129MB。我正在使用 Python 客户端进行上传:

swift_client = swiftclient.Connection(preauthurl=swift_public_auth_url,preauthtoken=swift_access_token,auth_version="2.0",insecure=True,tenant_name="admin")
with open("/path/to/file/file.ckpt", 'r') as read_file:
    swift_client.put_object(swift_container_name, 'file.ckpt', contents= read_file.read(),content_type='text/plain')
    print "done"

这会引发以下错误:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1824, in put_object
    response_dict=response_dict)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1673, in _retry
    service_token=self.service_token, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1322, in put_object
    raise ClientException.from_response(resp, 'Object PUT failed', body)
swiftclient.exceptions.ClientException: Object PUT failed: https://abc.xyz/swift/v1/AUTH_123456789abcdefghijklmn/container/file.ckpt 413 Request Entity Too Large  [first 60 chars of response] <html>
<head><title>413 Request Entity Too Large</title></h

但是,当我尝试用空白文本文件 test.txt 替换 test.ckpt 时,它使用相同的参数上传。我知道当文件大小大于 5GB 时会发生此错误,但这里可能是什么问题?

【问题讨论】:

    标签: openstack openstack-swift


    【解决方案1】:

    发现问题出在我的 Nginx 代理服务器上的配置。通过增加 client_max_body_size 来修复它。更多细节在这里:https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/

    【讨论】:

      猜你喜欢
      • 2011-07-07
      • 2015-03-17
      • 2022-11-11
      • 2012-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多