Mindmajix

Downloading objects In OpenStack

Now that we have configured OpenStack Object Storage, we can also retrieve the stored objects using our swift client.

Getting ready

Log in to a computer or server has the swift client package installed.

How to achieve it…

We will download objects from our OpenStack Object Storage environment using the different swift client options:

Downloading objects

To download the object tmp/test/test1, we issue the following command:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \
-U cookbook:demo -K openstack download test tmp/test/test1

This downloads the object to our filesystem. As we downloaded a file with the full path, this directory structure is preserved, so we end up with a new directory structure of tmp/test with a file in it called test1.

Downloading objects with the -o parameter

To download the file without preserving the file structure, or to simply rename it to something else, we specify the -o parameter, as follows:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack download test \ tmp/test/test1 -o test1

Downloading all objects from a container

We are also able to download complete containers to our local file system. To do this, we simply specify the container we want to download, as follows:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack download test

This will download all objects found under the test container.

Downloading all objects from our OpenStack Object Storage account

We can download all objects that reside under our OpenStack Object Storage account. If we have multiple containers, all objects from all containers will be downloaded. We do this with the                        parameter, as follows:

swift -V 2.0 -A http://172.16.0.200:5000/v2.0/ \ -U cookbook:demo -K openstack download --all

This will download all objects with full paths preceded by the container name, for example:

Capture 11

How it works…

The swift client is a basic but versatile tool that allows us to do many of the things we want to do with files. Downloading objects and containers is achieved using the following syntax:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \
-U tenant:user -K password download container {object … }

To download all objects from our account (for example, from all containers), we specify the following syntax:

swift -V 2.0 -A http://keystone_server:5000/v2.0 \ -U tenant:user -K password download --all

 http://docs.openstack.org/cli-reference/swift.html

 

0 Responses on Downloading objects In OpenStack"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.