[英]How do I upload a large SQLite file to Object Storage using OpenStack's Swift (via Python)
I have an Object Storage instance on IBM's Bluemix, and I'm attempting to upload a ~32GB SQLite file. 我在IBM的Bluemix上有一个对象存储实例,并且试图上载〜32GB的SQLite文件。 Here is my Python code which uses the OpenStack Swift API (with the credentials removed):
这是我的Python代码,该代码使用OpenStack Swift API(已删除凭据):
import swiftclient
conn = swiftclient.Connection(key="pw",authurl="url",auth_version='3',os_options={"project_id": "project_id","user_id": "user_id","region_name": "region"})
container_name = 'containerName'
file_name = 'file.sqlite'
with open(file_name, 'rb') as sqlite_file:
conn.put_object(container_name,file_name,sqlite_file)
I tested this code with a small .html file and it uploaded without a problem. 我用一个小的.html文件测试了此代码,并成功上传了代码。 When I changed the file to the SQLite file, it ran for > 5 hours and eventually gave a "requests.exceptions.ConnectionError: [Errno 32] Broken pipe" error.
当我将文件更改为SQLite文件时,它运行了5个小时以上,并最终出现“ requests.exceptions.ConnectionError:[Errno 32]管道损坏”错误。 What am I doing wrong?
我究竟做错了什么?
You'll need to read-up on Swift DLO/SLO support and manifests. 您需要阅读有关Swift DLO / SLO的支持和清单。 Here's a blog post that might help with context on what manifests are and the differences between Static Large Object and Dynamic Large Object support.
这是一篇博客文章 ,可帮助您了解清单的内容以及静态大对象和动态大对象支持之间的区别。
Basically, I'd recommend the following approach: 基本上,我建议采用以下方法:
$ swift --os-auth-url=https://identity.open.softlayer.com/v3 --os-user- id=some_hex_value --os-password="weird_characters" --os-project-id=another_hex_value --os-region-name=dallas -V 3 upload my_object_storage_container_name -S int_seg_size_in_bytes my_local_large_file_with_some_extension --use-slo
my_local_large_file_with_some_extension segment 3
my_local_large_file_with_some_extension segment 1
my_local_large_file_with_some_extension segment 2
my_local_large_file_with_some_extension segment 0
my_local_large_file_with_some_extension/1443450560.000000/160872806/52428800/00000002
my_local_large_file_with_some_extension/1443450560.000000/160872806/52428800/00000003
my_local_large_file_with_some_extension/1443450560.000000/160872806/52428800/00000001
my_local_large_file_with_some_extension/1443450560.000000/160872806/52428800/00000000
my_local_large_file_with_some_extension
Good luck. 祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.