简体   繁体   English

解压缩CDN的Rackspace云文件容器上的文件

[英]Uncompress file on Rackspace cloud files container for CDN

I have created a Rackspace account earlier today for CDN to serve my Opencart images from Rackspace. 我今天早些时候已经为CDN创建了一个Rackspace帐户,以从Rackspace提供我的Opencart映像。

I have created a container where i will upload over 500,000 images, but prefer to upload them as a compressed file, feels more flexible. 我创建了一个容器,可以在其中上传500,000张图像,但是更喜欢将它们作为压缩文件上传,感觉更加灵活。

If i upload all the images in a compressed file how do i extract the file when it is in the container? 如果我将所有图像上传到压缩文件中,当文件在容器中时如何提取? and what compression type files would work? 哪些压缩类型的文件会起作用?

The answer may depend on how you are attempting to upload your file/files. 答案可能取决于您尝试上载文件的方式。 Since this was not specified, I will answer your question using the CLI from a *nix environment. 由于未指定,因此我将在* nix环境中使用CLI回答您的问题。

Answer to your question (using curl) 回答您的问题(使用curl)

Using curl, you can upload a compressed file and have it extracted using the extract-archive feature. 使用curl可以上传压缩文件,并使用extract-archive功能将其提取。

$ tar cf archive.tar directory_to_be_archived
$ curl -i -XPUT -H'x-auth-token: AUTH_TOKEN' https://storage101.iad3.clouddrive.com/v1/MossoCloudFS_aaa-aaa-aaa-aaa?extract-archive=tar -T ./archive.tar

You can find the documentation for this feature here: http://docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html 您可以在以下位置找到此功能的文档: http : //docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html

Recommended solution (using Swiftly) 推荐的解决方案(快速使用)

Uploading and extracting that many objects using the above method might take a long time to complete. 使用上述方法上载和提取许多对象可能需要很长时间才能完成。 Additionally if there is a network interruption during that time, you will have to start over from the beginning. 此外,如果在此期间网络中断,则必须从头开始。

I would recommend instead using a tool like Swiftly, which will allow you to concurrently upload your files. 我建议改用Swiftly这样的工具,该工具可让您同时上传文件。 This way if there is a problem during the upload, you don't have to re-upload objects that have alreaady been successfully uploaded. 这样,如果上传过程中出现问题,则不必重新上传已经成功上传的对象。

An example of how to do this is as follows: 如何执行此操作的示例如下:

$ swiftly --auth-url="https://identity.api.rackspacecloud.com/v2.0" \
--auth-user="{username}" --auth-key="{api_key}" --region="DFW" \
--concurrency=10 put container_name -i images/

If there is a network interruption while uploading, or you have to stop/restart uploading your files, you can add the "--different" option after the 'put' in the above command. 如果上载时网络中断,或者您必须停止/重新开始上载文件,则可以在上述命令中的“ put”后面添加“ --different”选项。 This will tell Swiftly to HEAD the object first and only upload if the time or size of the local file does not match its corresponding object, skipping objects that have already been uploaded. 这将迅速告诉HEAD首先该对象,并且仅在本地文件的时间或大小与相应对象不匹配时才上传,跳过已上传的对象。

Swiftly can be found on github here: https://github.com/gholt/swiftly 可以在github上快速找到它: https : //github.com/gholt/swiftly

There are other clients that possibly do the same things, but I know Swiftly works, so I recommend it. 还有其他客户端可能会执行相同的操作,但是我知道Swift可以正常工作,因此我建议这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM