1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
|
Managing Unified File and Object Storage
========================================
Unified File and Object Storage (UFO) unifies NAS and object storage
technology. It provides a system for data storage that enables users to
access the same data, both as an object and as a file, thus simplifying
management and controlling storage costs.
Unified File and Object Storage is built upon Openstack's Object Storage
Swift. Open Stack Object Storage allows users to store and retrieve
files and content through a simple Web Service (REST: Representational
State Transfer) interface as objects and GlusterFS, allows users to
store and retrieve files using Native Fuse and NFS mounts. It uses
GlusterFS as a backend file system for Open Stack Swift. It also
leverages on Open Stack Swift's web interface for storing and retrieving
files over the web combined with GlusterFS features like scalability and
high availability, replication, elastic volume management for data
management at disk level.
Unified File and Object Storage technology enables enterprises to adopt
and deploy cloud storage solutions. It allows users to access and modify
data as objects from a REST interface along with the ability to access
and modify files from NAS interfaces including NFS and CIFS. In addition
to decreasing cost and making it faster and easier to access object
data, it also delivers massive scalability, high availability and
replication of object storage. Infrastructure as a Service (IaaS)
providers can utilize GlusterFS Unified File and Object Storage
technology to enable their own cloud storage service. Enterprises can
use this technology to accelerate the process of preparing file-based
applications for the cloud and simplify new application development for
cloud computing environments.
OpenStack Object Storage is scalable object storage system and it is not
a traditional file system. You will not be able to mount this system
like traditional SAN or NAS volumes and perform POSIX compliant
operations.
Components of Object Storage
============================
The major components of Object Storage are:
**Proxy Server**
All REST requests to the UFO are routed through the Proxy Server.
**Objects and Containers**
An object is the basic storage entity and any optional metadata that
represents the data you store. When you upload data, the data is stored
as-is (with no compression or encryption).
A container is a storage compartment for your data and provides a way
for you to organize your data. Containers can be visualized as
directories in a Linux system. Data must be stored in a container and
hence objects are created within a container.
It implements objects as files and directories under the container. The
object name is a '/' separated path and UFO maps it to directories until
the last name in the path, which is marked as a file. With this
approach, objects can be accessed as files and directories from native
GlusterFS (FUSE) or NFS mounts by providing the '/' separated path.
**Accounts and Account Servers**
The OpenStack Object Storage system is designed to be used by many
different storage consumers. Each user is associated with one or more
accounts and must identify themselves using an authentication system.
While authenticating, users must provide the name of the account for
which the authentication is requested.
UFO implements accounts as GlusterFS volumes. So, when a user is granted
read/write permission on an account, it means that that user has access
to all the data available on that GlusterFS volume.
**Authentication and Access Permissions**
You must authenticate against an authentication service to receive
OpenStack Object Storage connection parameters and an authentication
token. The token must be passed in for all subsequent container or
object operations. One authentication service that you can use as a
middleware example is called `tempauth`.
By default, each user has their own storage account and has full access
to that account. Users must authenticate with their credentials as
described above, but once authenticated they can manage containers and
objects within that account. If a user wants to access the content from
another account, they must have API access key or a session token
provided by their authentication system.
Advantages of using GlusterFS Unified File and Object Storage
=============================================================
The following are the advantages of using GlusterFS UFO:
- No limit on upload and download files sizes as compared to Open
Stack Swift which limits the object size to 5GB.
- A unified view of data across NAS and Object Storage technologies.
- Using GlusterFS's UFO has other advantages like the following:
- High availability
- Scalability
- Replication
- Elastic Volume management
Preparing to Deploy Unified File and Object Storage
===================================================
This section provides information on pre-requisites and list of
dependencies that will be installed during the installation of Unified
File and Object Storage.
Pre-requisites
--------------
GlusterFS's Unified File and Object Storage needs `user_xattr` support
from the underlying disk file system. Use the following command to
enable `user_xattr` for GlusterFS bricks backend:
`# mount –o remount,user_xattr `
For example,
`# mount –o remount,user_xattr /dev/hda1 `
Dependencies
------------
The following packages are installed on GlusterFS when you install
Unified File and Object Storage:
- curl
- memcached
- openssl
- xfsprogs
- python2.6
- pyxattr
- python-configobj
- python-setuptools
- python-simplejson
- python-webob
- python-eventlet
- python-greenlet
- python-pastedeploy
- python-netifaces
Installing and Configuring Unified File and Object Storage
==========================================================
This section provides instructions on how to install and configure
Unified File and Object Storage in your storage environment.
Installing Unified File and Object Storage
------------------------------------------
To install Unified File and Object Storage:
1. Download `rhel_install.sh` install script from [][] .
2. Run `rhel_install.sh` script using the following command:
`# sh rhel_install.sh`
3. Download `swift-1.4.5-1.noarch.rpm` and
`swift-plugin-1.0.-1.el6.noarch.rpm` files from [][].
4. Install `swift-1.4.5-1.noarch.rpm` and
`swift-plugin-1.0.-1.el6.noarch.rpm` using the following commands:
`# rpm -ivh swift-1.4.5-1.noarch.rpm`
`# rpm -ivh swift-plugin-1.0.-1.el6.noarch.rpm`
> **Note**
>
> You must repeat the above steps on all the machines on which you
> want to install Unified File and Object Storage. If you install
> the Unified File and Object Storage on multiple servers, you can
> use a load balancer like pound, nginx, and so on to distribute the
> request across the machines.
Adding Users
------------
The authentication system allows the administrator to grant different
levels of access to different users based on the requirement. The
following are the types of user permissions:
- admin user
- normal user
Admin user has read and write permissions on the account. By default, a
normal user has no read or write permissions. A normal user can only
authenticate itself to get a Auth-Token. Read or write permission are
provided through ACLs by the admin users.
Add a new user by adding the following entry in
`/etc/swift/proxy-server.conf` file:
`user_<account-name>_<user-name> = <password> [.admin]`
For example,
`user_test_tester = testing .admin`
> **Note**
>
> During installation, the installation script adds few sample users to
> the `proxy-server.conf` file. It is highly recommended that you remove
> all the default sample user entries from the configuration file.
For more information on setting ACLs, see ?.
Configuring Proxy Server
------------------------
The Proxy Server is responsible for connecting to the rest of the
OpenStack Object Storage architecture. For each request, it looks up the
location of the account, container, or object in the ring and route the
request accordingly. The public API is also exposed through the proxy
server. When objects are streamed to or from an object server, they are
streamed directly through the proxy server to or from the user – the
proxy server does not spool them.
The configurable options pertaining to proxy server are stored in
`/etc/swift/proxy-server.conf`. The following is the sample
`proxy-server.conf` file:
[app:proxy-server]
use = egg:swift#proxy
allow_account_management=true
account_autocreate=true
[filter:tempauth]
use = egg:swift#tempauth user_admin_admin=admin.admin.reseller_admin
user_test_tester=testing.admin
user_test2_tester2=testing2.admin
user_test_tester3=testing3
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
use = egg:swift#memcache
By default, GlusterFS's Unified File and Object Storage is configured to
support HTTP protocol and uses temporary authentication to authenticate
the HTTP requests.
Configuring Authentication System
---------------------------------
Proxy server must be configured to authenticate using `
`.
Configuring Proxy Server for HTTPS
----------------------------------
By default, proxy server only handles HTTP request. To configure the
proxy server to process HTTPS requests, perform the following steps:
1. Create self-signed cert for SSL using the following commands:
cd /etc/swift
openssl req -new -x509 -nodes -out cert.crt -keyout cert.key
2. Add the following lines to `/etc/swift/proxy-server.conf `under
[DEFAULT]
bind_port = 443
cert_file = /etc/swift/cert.crt
key_file = /etc/swift/cert.key
3. Restart the servers using the following commands:
swift-init main stop
swift-init main start
The following are the configurable options:
Option Default Description
------------ ------------ -------------------------------
bind\_ip 0.0.0.0 IP Address for server to bind
bind\_port 80 Port for server to bind
swift\_dir /etc/swift Swift configuration directory
workers 1 Number of workers to fork
user swift swift user
cert\_file Path to the ssl .crt
key\_file Path to the ssl .key
: proxy-server.conf Default Options in the [DEFAULT] section
Option Default Description
------------------------------- ----------------- -----------------------------------------------------------------------------------------------------------
use paste.deploy entry point for the container server. For most cases, this should be `egg:swift#container`.
log\_name proxy-server Label used when logging
log\_facility LOG\_LOCAL0 Syslog log facility
log\_level INFO Log level
log\_headers True If True, log headers in each request
recheck\_account\_existence 60 Cache timeout in seconds to send memcached for account existence
recheck\_container\_existence 60 Cache timeout in seconds to send memcached for container existence
object\_chunk\_size 65536 Chunk size to read from object servers
client\_chunk\_size 65536 Chunk size to read from clients
memcache\_servers 127.0.0.1:11211 Comma separated list of memcached servers ip:port
node\_timeout 10 Request timeout to external services
client\_timeout 60 Timeout to read one chunk from a client
conn\_timeout 0.5 Connection timeout to external services
error\_suppression\_interval 60 Time in seconds that must elapse since the last error for a node to be considered no longer error limited
error\_suppression\_limit 10 Error count to consider a node error limited
allow\_account\_management false Whether account `PUT`s and `DELETE`s are even callable
: proxy-server.conf Server Options in the [proxy-server] section
Configuring Object Server
-------------------------
The Object Server is a very simple blob storage server that can store,
retrieve, and delete objects stored on local devices. Objects are stored
as binary files on the file system with metadata stored in the file’s
extended attributes (xattrs). This requires that the underlying file
system choice for object servers support xattrs on files.
The configurable options pertaining Object Server are stored in the file
`/etc/swift/object-server/1.conf`. The following is the sample
`object-server/1.conf` file:
[DEFAULT]
devices = /srv/1/node
mount_check = false
bind_port = 6010
user = root
log_facility = LOG_LOCAL2
[pipeline:main]
pipeline = gluster object-server
[app:object-server]
use = egg:swift#object
[filter:gluster]
use = egg:swift#gluster
[object-replicator]
vm_test_mode = yes
[object-updater]
[object-auditor]
The following are the configurable options:
Option Default Description
-------------- ------------ ----------------------------------------------------------------------------------------------------
swift\_dir /etc/swift Swift configuration directory
devices /srv/node Mount parent directory where devices are mounted
mount\_check true Whether or not check if the devices are mounted to prevent accidentally writing to the root device
bind\_ip 0.0.0.0 IP Address for server to bind
bind\_port 6000 Port for server to bind
workers 1 Number of workers to fork
: object-server.conf Default Options in the [DEFAULT] section
Option Default Description
---------------------- --------------- ----------------------------------------------------------------------------------------------------
use paste.deploy entry point for the object server. For most cases, this should be `egg:swift#object`.
log\_name object-server log name used when logging
log\_facility LOG\_LOCAL0 Syslog log facility
log\_level INFO Logging level
log\_requests True Whether or not to log each request
user swift swift user
node\_timeout 3 Request timeout to external services
conn\_timeout 0.5 Connection timeout to external services
network\_chunk\_size 65536 Size of chunks to read or write over the network
disk\_chunk\_size 65536 Size of chunks to read or write to disk
max\_upload\_time 65536 Maximum time allowed to upload an object
slow 0 If \> 0, Minimum time in seconds for a `PUT` or `DELETE` request to complete
: object-server.conf Server Options in the [object-server] section
Configuring Container Server
----------------------------
The Container Server’s primary job is to handle listings of objects. The
listing is done by querying the GlusterFS mount point with path. This
query returns a list of all files and directories present under that
container.
The configurable options pertaining to container server are stored in
`/etc/swift/container-server/1.conf` file. The following is the sample
`container-server/1.conf` file:
[DEFAULT]
devices = /srv/1/node
mount_check = false
bind_port = 6011
user = root
log_facility = LOG_LOCAL2
[pipeline:main]
pipeline = gluster container-server
[app:container-server]
use = egg:swift#container
[filter:gluster]
use = egg:swift#gluster
[container-replicator]
[container-updater]
[container-auditor]
The following are the configurable options:
Option Default Description
-------------- ------------ ----------------------------------------------------------------------------------------------------
swift\_dir /etc/swift Swift configuration directory
devices /srv/node Mount parent directory where devices are mounted
mount\_check true Whether or not check if the devices are mounted to prevent accidentally writing to the root device
bind\_ip 0.0.0.0 IP Address for server to bind
bind\_port 6001 Port for server to bind
workers 1 Number of workers to fork
user swift Swift user
: container-server.conf Default Options in the [DEFAULT] section
Option Default Description
--------------- ------------------ ----------------------------------------------------------------------------------------------------------
use paste.deploy entry point for the container server. For most cases, this should be `egg:swift#container`.
log\_name container-server Label used when logging
log\_facility LOG\_LOCAL0 Syslog log facility
log\_level INFO Logging level
node\_timeout 3 Request timeout to external services
conn\_timeout 0.5 Connection timeout to external services
: container-server.conf Server Options in the [container-server]
section
Configuring Account Server
--------------------------
The Account Server is very similar to the Container Server, except that
it is responsible for listing of containers rather than objects. In UFO,
each gluster volume is an account.
The configurable options pertaining to account server are stored in
`/etc/swift/account-server/1.conf` file. The following is the sample
`account-server/1.conf` file:
[DEFAULT]
devices = /srv/1/node
mount_check = false
bind_port = 6012
user = root
log_facility = LOG_LOCAL2
[pipeline:main]
pipeline = gluster account-server
[app:account-server]
use = egg:swift#account
[filter:gluster]
use = egg:swift#gluster
[account-replicator]
vm_test_mode = yes
[account-auditor]
[account-reaper]
The following are the configurable options:
Option Default Description
-------------- ------------ ----------------------------------------------------------------------------------------------------
swift\_dir /etc/swift Swift configuration directory
devices /srv/node mount parent directory where devices are mounted
mount\_check true Whether or not check if the devices are mounted to prevent accidentally writing to the root device
bind\_ip 0.0.0.0 IP Address for server to bind
bind\_port 6002 Port for server to bind
workers 1 Number of workers to fork
user swift Swift user
: account-server.conf Default Options in the [DEFAULT] section
Option Default Description
--------------- ---------------- ----------------------------------------------------------------------------------------------------------
use paste.deploy entry point for the container server. For most cases, this should be `egg:swift#container`.
log\_name account-server Label used when logging
log\_facility LOG\_LOCAL0 Syslog log facility
log\_level INFO Logging level
: account-server.conf Server Options in the [account-server] section
Starting and Stopping Server
----------------------------
You must start the server manually when system reboots and whenever you
update/modify the configuration files.
- To start the server, enter the following command:
`# swift_init main start`
- To stop the server, enter the following command:
`# swift_init main stop`
Working with Unified File and Object Storage
============================================
This section describes the REST API for administering and managing
Object Storage. All requests will be directed to the host and URL
described in the `X-Storage-URL HTTP` header obtained during successful
authentication.
Configuring Authenticated Access
--------------------------------
Authentication is the process of proving identity to the system. To use
the REST interface, you must obtain an authorization token using GET
method and supply it with v1.0 as the path.
Each REST request against the Object Storage system requires the
addition of a specific authorization token HTTP x-header, defined as
X-Auth-Token. The storage URL and authentication token are returned in
the headers of the response.
- To authenticate, run the following command:
GET auth/v1.0 HTTP/1.1
Host: <auth URL>
X-Auth-User: <account name>:<user name>
X-Auth-Key: <user-Password>
For example,
GET auth/v1.0 HTTP/1.1
Host: auth.example.com
X-Auth-User: test:tester
X-Auth-Key: testing
HTTP/1.1 200 OK
X-Storage-Url: https:/example.storage.com:443/v1/AUTH_test
X-Storage-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554
X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554
Content-Length: 0
Date: Wed, 10 jul 2011 06:11:51 GMT
To authenticate access using cURL (for the above example), run the
following command:
curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass:testing' -k
https://auth.example.com:443/auth/v1.0
The X-Auth-Url has to be parsed and used in the connection and
request line of all subsequent requests to the server. In the
example output, users connecting to server will send most
container/object requests with a host header of example.storage.com
and the request line's version and account as v1/AUTH\_test.
> **Note**
>
> The authentication tokens are valid for a 24 hour period.
Working with Accounts
---------------------
This section describes the list of operations you can perform at the
account level of the URL.
### Displaying Container Information
You can list the objects of a specific container, or all containers, as
needed using GET command. You can use the following optional parameters
with GET request to refine the results:
Parameter Description
----------- --------------------------------------------------------------------------
limit Limits the number of results to at most *n* value.
marker Returns object names greater in value than the specified marker.
format Specify either json or xml to return the respective serialized response.
**To display container information**
- List all the containers of an account using the following command:
GET /<apiversion>/<account> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
GET /v1/AUTH_test HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 200 Ok
Date: Wed, 13 Jul 2011 16:32:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
Content-Length: 39
songs
movies
documents
reports
To display container information using cURL (for the above example), run
the following command:
curl -v -X GET -H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test -k
### Displaying Account Metadata Information
You can issue HEAD command to the storage service to view the number of
containers and the total bytes stored in the account.
- To display containers and storage used, run the following command:
HEAD /<apiversion>/<account> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
HEAD /v1/AUTH_test HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 16:52:21 GMT
Server: Apache
X-Account-Container-Count: 4
X-Account-Total-Bytes-Used: 394792
To display account metadata information using cURL (for the above
example), run the following command:
curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test -k
Working with Containers
-----------------------
This section describes the list of operations you can perform at the
container level of the URL.
### Creating Containers
You can use PUT command to create containers. Containers are the storage
folders for your data. The URL encoded name must be less than 256 bytes
and cannot contain a forward slash '/' character.
- To create a container, run the following command:
PUT /<apiversion>/<account>/<container>/ HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
PUT /v1/AUTH_test/pictures/ HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 201 Created
Date: Wed, 13 Jul 2011 17:32:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
To create container using cURL (for the above example), run the
following command:
curl -v -X PUT -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures -k
The status code of 201 (Created) indicates that you have
successfully created the container. If a container with same is
already existed, the status code of 202 is displayed.
### Displaying Objects of a Container
You can list the objects of a container using GET command. You can use
the following optional parameters with GET request to refine the
results:
Parameter Description
----------- --------------------------------------------------------------------------------------------------------------
limit Limits the number of results to at most *n* value.
marker Returns object names greater in value than the specified marker.
prefix Displays the results limited to object names beginning with the substring x. beginning with the substring x.
path Returns the object names nested in the pseudo path.
format Specify either json or xml to return the respective serialized response.
delimiter Returns all the object names nested in the container.
To display objects of a container
- List objects of a specific container using the following command:
<!-- -->
GET /<apiversion>/<account>/<container>[parm=value] HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
GET /v1/AUTH_test/images HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 200 Ok
Date: Wed, 13 Jul 2011 15:42:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
Content-Length: 139
sample file.jpg
test-file.pdf
You and Me.pdf
Puddle of Mudd.mp3
Test Reports.doc
To display objects of a container using cURL (for the above example),
run the following command:
curl -v -X GET-H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images -k
### Displaying Container Metadata Information
You can issue HEAD command to the storage service to view the number of
objects in a container and the total bytes of all the objects stored in
the container.
- To display list of objects and storage used, run the following
command:
HEAD /<apiversion>/<account>/<container> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
HEAD /v1/AUTH_test/images HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 19:52:21 GMT
Server: Apache
X-Account-Object-Count: 8
X-Container-Bytes-Used: 472
To display list of objects and storage used in a container using
cURL (for the above example), run the following command:
curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images -k
### Deleting Container
You can use DELETE command to permanently delete containers. The
container must be empty before it can be deleted.
You can issue HEAD command to determine if it contains any objects.
- To delete a container, run the following command:
DELETE /<apiversion>/<account>/<container>/ HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
For example,
DELETE /v1/AUTH_test/pictures HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 17:52:21 GMT
Server: Apache
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
To delete a container using cURL (for the above example), run the
following command:
curl -v -X DELETE -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures -k
The status code of 204 (No Content) indicates that you have
successfully deleted the container. If that container does not
exist, the status code 404 (Not Found) is displayed, and if the
container is not empty, the status code 409 (Conflict) is displayed.
### Updating Container Metadata
You can update the metadata of container using POST operation, metadata
keys should be prefixed with 'x-container-meta'.
- To update the metadata of the object, run the following command:
POST /<apiversion>/<account>/<container> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key>
X-Container-Meta-<key>: <new value>
X-Container-Meta-<key>: <new value>
For example,
POST /v1/AUTH_test/images HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
X-Container-Meta-Zoo: Lion
X-Container-Meta-Home: Dog
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 20:52:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
To update the metadata of the object using cURL (for the above
example), run the following command:
curl -v -X POST -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images -H ' X-Container-Meta-Zoo: Lion' -H 'X-Container-Meta-Home: Dog' -k
The status code of 204 (No Content) indicates the container's
metadata is updated successfully. If that object does not exist, the
status code 404 (Not Found) is displayed.
### Setting ACLs on Container
You can set the container access control list by using POST command on
container with `x- container-read` and` x-container-write` keys.
The ACL format is `[item[,item...]]`. Each item can be a group name to
give access to or a referrer designation to grant or deny based on the
HTTP Referer header.
The referrer designation format is:` .r:[-]value`.
The .r can also be `.ref, .referer, `or .`referrer`; though it will be
shortened to.r for decreased character count usage. The value can be `*`
to specify any referrer host is allowed access. The leading minus sign
(-) indicates referrer hosts that should be denied access.
Examples of valid ACLs:
.r:*
.r:*,bobs_account,sues_account:sue
bobs_account,sues_account:sue
Examples of invalid ACLs:
.r:
.r:-
By default, allowing read access via `r `will not allow listing objects
in the container but allows retrieving objects from the container. To
turn on listings, use the .`rlistings` directive. Also, `.r`
designations are not allowed in headers whose names include the word
write.
For example, to set all the objects access rights to "public" inside the
container using cURL (for the above example), run the following command:
curl -v -X POST -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images
-H 'X-Container-Read: .r:*' -k
Working with Objects
--------------------
An object represents the data and any metadata for the files stored in
the system. Through the REST interface, metadata for an object can be
included by adding custom HTTP headers to the request and the data
payload as the request body. Objects name should not exceed 1024 bytes
after URL encoding.
This section describes the list of operations you can perform at the
object level of the URL.
### Creating or Updating Object
You can use PUT command to write or update an object's content and
metadata.
You can verify the data integrity by including an MD5checksum for the
object's data in the ETag header. ETag header is optional and can be
used to ensure that the object's contents are stored successfully in the
storage system.
You can assign custom metadata to objects by including additional HTTP
headers on the PUT request. The objects created with custom metadata via
HTTP headers are identified with the`X-Object- Meta`- prefix.
- To create or update an object, run the following command:
PUT /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
ETag: da1e100dc9e7becc810986e37875ae38
Content-Length: 342909
X-Object-Meta-PIN: 2343
For example,
PUT /v1/AUTH_test/pictures/dog HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
ETag: da1e100dc9e7becc810986e37875ae38
HTTP/1.1 201 Created
Date: Wed, 13 Jul 2011 18:32:21 GMT
Server: Apache
ETag: da1e100dc9e7becc810986e37875ae38
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
To create or update an object using cURL (for the above example),
run the following command:
curl -v -X PUT -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures/dog -H 'Content-
Length: 0' -k
The status code of 201 (Created) indicates that you have
successfully created or updated the object. If there is a missing
content-Length or Content-Type header in the request, the status
code of 412 (Length Required) is displayed. (Optionally) If the MD5
checksum of the data written to the storage system does not match
the ETag value, the status code of 422 (Unprocessable Entity) is
displayed.
#### Chunked Transfer Encoding
You can upload data without knowing the size of the data to be uploaded.
You can do this by specifying an HTTP header of Transfer-Encoding:
chunked and without using a Content-Length header.
You can use this feature while doing a DB dump, piping the output
through gzip, and then piping the data directly into Object Storage
without having to buffer the data to disk to compute the file size.
- To create or update an object, run the following command:
PUT /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key>
Transfer-Encoding: chunked
X-Object-Meta-PIN: 2343
For example,
PUT /v1/AUTH_test/pictures/cat HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
Transfer-Encoding: chunked
X-Object-Meta-PIN: 2343
19
A bunch of data broken up
D
into chunks.
0
### Copying Object
You can copy object from one container to another or add a new object
and then add reference to designate the source of the data from another
container.
**To copy object from one container to another**
- To add a new object and designate the source of the data from
another container, run the following command:
COPY /<apiversion>/<account>/<container>/<sourceobject> HTTP/1.1
Host: <storage URL>
X-Auth-Token: < authentication-token-key>
Destination: /<container>/<destinationobject>
For example,
COPY /v1/AUTH_test/images/dogs HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
Destination: /photos/cats
HTTP/1.1 201 Created
Date: Wed, 13 Jul 2011 18:32:21 GMT
Server: Apache
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
To copy an object using cURL (for the above example), run the
following command:
curl -v -X COPY -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554' -H 'Destination: /photos/cats' -k https://example.storage.com:443/v1/AUTH_test/images/dogs
The status code of 201 (Created) indicates that you have
successfully copied the object. If there is a missing content-Length
or Content-Type header in the request, the status code of 412
(Length Required) is displayed.
You can also use PUT command to copy object by using additional
header `X-Copy-From: container/obj`.
- To use PUT command to copy an object, run the following command:
PUT /v1/AUTH_test/photos/cats HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
X-Copy-From: /images/dogs
HTTP/1.1 201 Created
Date: Wed, 13 Jul 2011 18:32:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
To copy an object using cURL (for the above example), run the
following command:
curl -v -X PUT -H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554'
-H 'X-Copy-From: /images/dogs' –k
https://example.storage.com:443/v1/AUTH_test/images/cats
The status code of 201 (Created) indicates that you have
successfully copied the object.
### Displaying Object Information
You can issue GET command on an object to view the object data of the
object.
- To display the content of an object run the following command:
GET /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key>
For example,
GET /v1/AUTH_test/images/cat HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 200 Ok
Date: Wed, 13 Jul 2011 23:52:21 GMT
Server: Apache
Last-Modified: Thu, 14 Jul 2011 13:40:18 GMT
ETag: 8a964ee2a5e88be344f36c22562a6486
Content-Length: 534210
[.........]
To display the content of an object using cURL (for the above
example), run the following command:
curl -v -X GET -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images/cat -k
The status code of 200 (Ok) indicates the object's data is displayed
successfully. If that object does not exist, the status code 404
(Not Found) is displayed.
### Displaying Object Metadata
You can issue HEAD command on an object to view the object metadata and
other standard HTTP headers. You must send only authorization token as
header.
- To display the metadata of the object, run the following command:
<!-- -->
HEAD /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key>
For example,
HEAD /v1/AUTH_test/images/cat HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 21:52:21 GMT
Server: Apache
Last-Modified: Thu, 14 Jul 2011 13:40:18 GMT
ETag: 8a964ee2a5e88be344f36c22562a6486
Content-Length: 512000
Content-Type: text/plain; charset=UTF-8
X-Object-Meta-House: Cat
X-Object-Meta-Zoo: Cat
X-Object-Meta-Home: Cat
X-Object-Meta-Park: Cat
To display the metadata of the object using cURL (for the above
example), run the following command:
curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images/cat -k
The status code of 204 (No Content) indicates the object's metadata is
displayed successfully. If that object does not exist, the status code
404 (Not Found) is displayed.
### Updating Object Metadata
You can issue POST command on an object name only to set or overwrite
arbitrary key metadata. You cannot change the object's other headers
such as Content-Type, ETag and others using POST operation. The POST
command will delete all the existing metadata and replace it with the
new arbitrary key metadata.
You must prefix **X-Object-Meta-** to the key names.
- To update the metadata of an object, run the following command:
POST /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key>
X-Object-Meta-<key>: <new value>
X-Object-Meta-<key>: <new value>
For example,
POST /v1/AUTH_test/images/cat HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
X-Object-Meta-Zoo: Lion
X-Object-Meta-Home: Dog
HTTP/1.1 202 Accepted
Date: Wed, 13 Jul 2011 22:52:21 GMT
Server: Apache
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
To update the metadata of an object using cURL (for the above
example), run the following command:
curl -v -X POST -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images/cat -H ' X-Object-
Meta-Zoo: Lion' -H 'X-Object-Meta-Home: Dog' -k
The status code of 202 (Accepted) indicates that you have
successfully updated the object's metadata. If that object does not
exist, the status code 404 (Not Found) is displayed.
### Deleting Object
You can use DELETE command to permanently delete the object.
The DELETE command on an object will be processed immediately and any
subsequent operations like GET, HEAD, POST, or DELETE on the object will
display 404 (Not Found) error.
- To delete an object, run the following command:
DELETE /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key>
For example,
DELETE /v1/AUTH_test/pictures/cat HTTP/1.1
Host: example.storage.com
X-Auth-Token: AUTH_tkd3ad38b087b49bbbac0494f7600a554
HTTP/1.1 204 No Content
Date: Wed, 13 Jul 2011 20:52:21 GMT
Server: Apache
Content-Type: text/plain; charset=UTF-8
To delete an object using cURL (for the above example), run the
following command:
curl -v -X DELETE -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures/cat -k
The status code of 204 (No Content) indicates that you have
successfully deleted the object. If that object does not exist, the
status code 404 (Not Found) is displayed.
[]: http://download.gluster.com/pub/gluster/glusterfs/3.2/UFO/
|