Swift (Object Store)

City Cloud Object Storage (Swift) is used for redundant, scalable data storage using clusters of standardized servers to store petabytes of accessible data. It is a long-term storage system for large amounts of static data which can be retrieved and updated. Object Storage uses a distributed architecture with no central point of control, providing greater scalability, redundancy, and permanence. Objects are written to multiple hardware devices, with the OpenStack software responsible for ensuring data replication and integrity across the cluster. Storage clusters scale horizontally by adding new nodes. Should a node fail, OpenStack works to replicate its content from other active nodes. Because OpenStack uses software logic to ensure data replication and distribution across different devices, inexpensive commodity hard drives and servers can be used in lieu of more expensive equipment.

Object Storage is ideal for cost effective, scale-out storage. It provides a fully distributed, API-accessible storage platform that can be integrated directly into applications or used for backup, archiving, and data retention.

In City Cloud, a storage that manages data as objects. Each object typically includes the data itself, a variable amount of meta data and a unique identifier. In City Cloud, the object storage is based on a Ceph storage. Typical objects stored within are:

  • images
  • etc

Step-by-step guide using OpenStack client and Swift APIs

More information can be found in OpenStack developer documentation.

Follow steps below:

  1. Source OpenStack credentials
  2. Create a swift containeropenstack container create <container name>
  3. Upload an object into the containeropenstack object create <container name> <object to upload>
  4. List object in a containeropenstack object list <container name>

Step-by-step guide setting up Swift temporary URL (tempurl) for object in container

More information can be found in Ceph documentation.

Follow steps below:

  1. Source OpenStack credentials
  2. Setup variables for account, key, object & container in your terminal (note that we're using a password generator for generating the key):
    ACCOUNT="AUTH_`openstack project list -c ID -f value`"
    $ KEY=`pwgen 64 1`
    $ OBJECT="myobject"
    CONTAINER="mycontainer"
  3. Create object:
    $ echo "hello world" > $OBJECT
  4. Set account temp URL key:
    $ swift post -m "Temp-URL-Key-2:$KEY"
  5. Create container:
    swift post $CONTAINER
  6. Upload object:
    swift upload $CONTAINER $OBJECT
  7. Verify that object does not set global read ACL:
    $ curl https://swift-kna1.citycloud.com:8080/swift/v1/$ACCOUNT/$CONTAINER/$OBJECT # (returns AccessDenied)
  8. Create tempURL:
    TEMPURL=`swift tempurl GET 3600 https://swift-kna1.citycloud.com:8080/swift/v1/$ACCOUNT/$CONTAINER/$OBJECT $KEY`
  9. Fetch tempURL:
    curl $TEMPURL # (returns "hello world")