Bookmark this page

Guided Exercise: Analyzing Object Storage Technologies

In this exercise, you will create an object container, upload an object, and configure it to expire.

Outcomes

You should be able to:

  • Create a container.

  • Load objects into a container.

  • Configure object expiry.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command ensures that all resources required for the exercise are present.

[student@workstation ~]$ lab storage-compare start

Procedure 6.2. Instructions

  1. As the operator1 user in the finance project, create a new object container called customer-dropbox.

    1. On workstation source the identity environment file for the operator1 user in the finance project.

      [student@workstation ~]$ source ~/operator1-finance-rc
      [student@workstation ~(operator1-finance)]$
    2. Use the openstack container create command to create the container.

      [student@workstation ~(operator1-finance)]$ openstack container create \
      > customer-dropbox
      +------------------+------------------+-------------+
      | account          | container        | x-trans-id  |
      +------------------+------------------+-------------+
      | AUTH_3813...7d6f | customer-dropbox | tx91...c359 |
      +------------------+------------------+-------------+
  2. Upload statement-20200710.zip into customer-dropbox. Configure statement-20200710.zip to expire after 2 minutes. Verify the object is unavailable after the expiry time.

    1. Use the openstack object create command to upload /home/student/statement-20200710.zip into customer-dropbox.

      [student@workstation ~(operator1-finance)]$ openstack object create \
      > --name statement-20200710.zip \
      > customer-dropbox /home/student/statement-20200710.zip
      +------------------------+------------------+----------------------------------+
      | object                 | container        | etag                             |
      +------------------------+------------------+----------------------------------+
      | statement-20200710.zip | customer-dropbox | e5ff7d4d2f8b496b0ceef585b0b1ff84 |
      +------------------------+------------------+----------------------------------+
    2. Use the swift post command to set the expiry for statement-20200710.zip to 120 seconds from now.

      [student@workstation ~(operator1-finance)]$ swift post customer-dropbox \
      > statement-20200710.zip -H "X-Delete-After:120"

      Object expiry information is added to the hidden .expiring_objects account.

    3. Use the swift stat command to view the expiry time for the statement-20200710.zip object.

      [student@workstation ~(operator1-finance)]$ swift stat customer-dropbox \
      > statement-20200710.zip
                     Account: AUTH_381390ecd6d94ec297704a011dd87d6f
                   Container: customer-dropbox
                      Object: statement-20200710.zip
                Content Type: application/zip
              Content Length: 200
               Last Modified: Fri, 10 Jul 2020 03:40:33 GMT
                        ETag: e5ff7d4d2f8b496b0ceef585b0b1ff84
                 X-Delete-At: 1594352552
                 X-Timestamp: 1594352432.58468
               Accept-Ranges: bytes
                  X-Trans-Id: tx899d5c18498d4bdba028e-005f07e336
      X-Openstack-Request-Id: tx899d5c18498d4bdba028e-005f07e336

      Note that the X-Delete-After value was automatically converted to an X-Delete-At value, which is an absolute date and time in Unix timestamp format.

    4. Convert the X-Delete-At value to standard datetime format.

      [student@workstation ~(operator1-finance)]$ date -d @1594352552
      Fri Jul 10 03:42:32 UTC 2020
    5. The statement-20200710.zip object should be unavailable after the time shown in the previous step.

      [student@workstation ~(operator1-finance)]$ openstack object show \
      > customer-dropbox statement-20200710.zip
      Not Found (HTTP 404) (Request-ID: txf442ab46babf4ef0b4a79-005f07e6e5)
  3. Even though the statement-20200710.zip object is unavailable, it may not be deleted immediately. View the Swift logs on controller0.

    1. Log on to controller0 as heat-admin, then become root.

      [student@workstation ~(operator1-finance)]$ ssh heat-admin@controller0
      [heat-admin@controller0 ~]$ sudo -i
      [root@controller0 ~]#
    2. Use the grep command to search for object-expirer messages in /var/log/containers/swift/swift.log.

      [root@controller0 ~]# grep object-expirer /var/log/containers/swift/swift.log
      ...output omitted...
      Jul 10 03:44:43 controller0 object-expirer[5564]: Pass beginning for task account .expiring_objects; 1 possible containers; 1 possible objects (txn: tx6912349188844e679e7bf-005f07e42b)
      Jul 10 03:44:43 controller0 object-expirer[5564]: Pass completed in 0s; 1 objects expired (txn: tx58a6cc1f911d4de5ade04-005f07e42b)
      ...output omitted...

      The object-expirer daemon regularly checks for expiring objects in the hidden .expiring_objects account.

    3. When an object has expired, it will eventually be deleted, however it may take several minutes. Use the grep command to search for the deletion of the statement-20200710.zip object. Log out when finished.

      [root@controller0 ~]# grep DELETE /var/log/containers/swift/swift.log
      Jul 10 03:44:43 controller0 container-server[7928]: 172.24.4.1 - - [10/Jul/2020:03:44:43 +0000] "DELETE /d1/368/AUTH_381390ecd6d94ec297704a011dd87d6f/customer-dropbox/statement-20200710.zip" 204 - "DELETE http://localhost/d1/715/AUTH_381390ecd6d94ec297704a011dd87d6f/customer-dropbox/statement-20200710.zip" "tx17323833852e411696102-005f07e42b" "object-server 20" 0.0007 "-" 19 0
      Jul 10 03:44:43 controller0 object-server[7970]: 172.24.4.1 - - [10/Jul/2020:03:44:43 +0000] "DELETE /d1/715/AUTH_381390ecd6d94ec297704a011dd87d6f/customer-dropbox/statement-20200710.zip" 204 - "DELETE http://localhost/v1/AUTH_381390ecd6d94ec297704a011dd87d6f/customer-dropbox/statement-20200710.zip" "tx17323833852e411696102-005f07e42b" "proxy-server 6" 0.0162 "-" 20 0
      Jul 10 03:44:43 controller0 container-server[7928]: 172.24.4.1 - - [10/Jul/2020:03:44:43 +0000] "DELETE /d1/777/.expiring_objects/1594352470/1594352552-AUTH_381390ecd6d94ec297704a011dd87d6f/customer-dropbox/statement-20200710.zip" 204 - "-" "-" "direct-client 6" 0.0006 "-" 19 -
      Jul 10 03:44:43 controller0 account-server[7931]: 172.24.4.1 - - [10/Jul/2020:03:44:43 +0000] "PUT /d1/720/.expiring_objects/1594352470" 204 - "DELETE http://172.24.4.1:6001/d1/777/.expiring_objects/1594352470" "tx58a6cc1f911d4de5ade04-005f07e42b" "container-server 18" 0.0020 "-" 19 0
      Jul 10 03:44:43 controller0 container-server[7925]: 172.24.4.1 - - [10/Jul/2020:03:44:43 +0000] "DELETE /d1/777/.expiring_objects/1594352470" 204 - "DELETE http://localhost/v1/.expiring_objects/1594352470" "tx58a6cc1f911d4de5ade04-005f07e42b" "proxy-server 6" 0.0331 "-" 18 -

      After the object has been deleted, the expiry information for the object is also deleted from the .expiring_objects account.

Finish

On the workstation machine, use the lab command to complete this exercise. This is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab storage-compare finish

This concludes the guided exercise.

Revision: cl110-16.1-4c76154