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
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
|
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Administration_Guide.ent">
%BOOK_ENTITIES;
]>
<chapter id="chap-Administration_Guide-UFO">
<title>Managing Unified File and Object Storage</title>
<para>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.
</para>
<para>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.</para>
<para>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.
</para>
<para>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. </para>
<para><figure>
<title>Unified File and Object Storage Architecture</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/UFO_Architecture.png"/>
</imageobject>
</mediaobject>
</figure></para>
<section>
<title>Components of Object Storage</title>
<para>The major components of Object Storage are:
</para>
<para><emphasis role="bold">Proxy Server</emphasis>
</para>
<para>All REST requests to the UFO are routed through the Proxy Server.
</para>
<para><emphasis role="bold">Objects and Containers </emphasis></para>
<para>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).
</para>
<para>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.
</para>
<para>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.</para>
<para><emphasis role="bold">Accounts and Account Servers</emphasis></para>
<para>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.
</para>
<para>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.
</para>
<para><emphasis role="bold">Authentication and Access Permissions</emphasis>
</para>
<para>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 <literal>tempauth</literal>.</para>
<para>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.</para>
</section>
<section>
<title>Advantages of using GlusterFS Unified File and Object Storage</title>
<para>The following are the advantages of using GlusterFS UFO:</para>
<itemizedlist>
<listitem>
<para>No limit on upload and download files sizes as compared to Open Stack Swift which limits the object size to 5GB.</para>
</listitem>
<listitem>
<para>A unified view of data across NAS and Object Storage technologies.</para>
</listitem>
<listitem>
<para>Using GlusterFS's UFO has other advantages like the following: </para>
<para><itemizedlist>
<listitem>
<para>High availability</para>
</listitem>
<listitem>
<para>Scalability</para>
</listitem>
<listitem>
<para>Replication</para>
</listitem>
<listitem>
<para>Elastic Volume management</para>
</listitem>
</itemizedlist></para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Preparing to Deploy Unified File and Object Storage</title>
<para>This section provides information on pre-requisites and list of dependencies that will be installed
during the installation of Unified File and Object Storage.
</para>
<section>
<title>Pre-requisites </title>
<para>GlusterFS's Unified File and Object Storage needs <literal>user_xattr</literal> support from the underlying disk file system.
Use the following command to enable <literal>user_xattr</literal> for GlusterFS bricks backend:
</para>
<para><command># mount –o remount,user_xattr <replaceable>device name</replaceable></command></para>
<para>For example,
</para>
<para><command># mount –o remount,user_xattr /dev/hda1 </command>
</para>
</section>
<section>
<title>Dependencies </title>
<para>The following packages are installed on GlusterFS when you install Unified File and Object
Storage:
</para>
<itemizedlist>
<listitem>
<para>curl
</para>
</listitem>
<listitem>
<para>memcached</para>
</listitem>
<listitem>
<para>openssl</para>
</listitem>
<listitem>
<para>xfsprogs</para>
</listitem>
<listitem>
<para>python2.6</para>
</listitem>
<listitem>
<para>pyxattr</para>
</listitem>
<listitem>
<para>python-configobj
</para>
</listitem>
<listitem>
<para>python-setuptools
</para>
</listitem>
<listitem>
<para>python-simplejson
</para>
</listitem>
<listitem>
<para>python-webob
</para>
</listitem>
<listitem>
<para>python-eventlet
</para>
</listitem>
<listitem>
<para>python-greenlet
</para>
</listitem>
<listitem>
<para>python-pastedeploy
</para>
</listitem>
<listitem>
<para>python-netifaces
</para>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Installing and Configuring Unified File and Object Storage</title>
<para>This section provides instructions on how to install and configure Unified File and Object Storage in your storage
environment.</para>
<section id="chap-ation_Guide-Dir_Quota-Enable">
<title>Installing Unified File and Object Storage</title>
<para>To install Unified File and Object Storage:</para>
<orderedlist>
<listitem>
<para>Download <filename>rhel_install.sh</filename> install script from <ulink url="http://download.gluster.com/pub/gluster/glusterfs/3.2/UFO/"/> .
</para>
</listitem>
<listitem>
<para>Run
<filename>rhel_install.sh</filename> script using the following command:
</para>
<para><command># sh rhel_install.sh</command></para>
</listitem>
<listitem>
<para>Download <filename>swift-1.4.5-1.noarch.rpm</filename> and <filename>swift-plugin-1.0.-1.el6.noarch.rpm</filename> files from <ulink url="http://download.gluster.com/pub/gluster/glusterfs/3.2/UFO/"/>.</para>
</listitem>
<listitem>
<para>Install <filename>swift-1.4.5-1.noarch.rpm</filename> and <filename>swift-plugin-1.0.-1.el6.noarch.rpm</filename> using the following commands:</para>
<para><command># rpm -ivh swift-1.4.5-1.noarch.rpm</command></para>
<para><command># rpm -ivh swift-plugin-1.0.-1.el6.noarch.rpm</command></para>
<para><note>
<para>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.</para>
</note></para>
</listitem>
</orderedlist>
</section>
<section>
<title>Adding Users</title>
<para>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:
</para>
<itemizedlist>
<listitem>
<para>admin user
</para>
</listitem>
<listitem>
<para>normal user</para>
</listitem>
</itemizedlist>
<para>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.</para>
<para>Add a new user by adding the following entry in <filename>/etc/swift/proxy-server.conf</filename> file:</para>
<para><command>user_<account-name>_<user-name> = <password> [.admin]</command></para>
<para>For example, </para>
<para><command>user_test_tester = testing .admin</command>
</para>
<note>
<para>During installation, the installation script adds few sample users to the <filename>proxy-server.conf</filename> file. It is highly recommended that you remove all the default sample user entries from the configuration file.
</para>
</note>
<para>For more information on setting ACLs, see <xref linkend="chap-Administration_Guide-Working_UFO-Setting_ACLs"/>.</para>
</section>
<section>
<title>Configuring Proxy Server</title>
<para>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.
</para>
<para>The configurable options pertaining to proxy server are stored in <filename>/etc/swift/proxy-server.conf</filename>. The following is the sample <filename>proxy-server.conf</filename> file:</para>
<para><programlisting>[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</programlisting></para>
<para>By default, GlusterFS's Unified File and Object Storage is configured to support HTTP protocol and uses temporary authentication to authenticate the HTTP requests.</para>
</section>
<section>
<title>Configuring Authentication System</title>
<para>Proxy server must be configured to authenticate using <literal>
<literal>tempauth</literal>
</literal>. </para>
</section>
<section>
<title>Configuring Proxy Server for HTTPS</title>
<para>By default, proxy server only handles HTTP request. To configure the proxy server to process HTTPS requests, perform the following steps:</para>
<orderedlist>
<listitem>
<para>Create self-signed cert for SSL using the following commands:</para>
<para><programlisting>cd /etc/swift
openssl req -new -x509 -nodes -out cert.crt -keyout cert.key</programlisting></para>
</listitem>
<listitem>
<para>Add the following lines to <filename>/etc/swift/proxy-server.conf </filename>under <replaceable>[DEFAULT]</replaceable></para>
<para><programlisting>bind_port = 443
cert_file = /etc/swift/cert.crt
key_file = /etc/swift/cert.key</programlisting></para>
</listitem>
<listitem>
<para>Restart the servers using the following commands:</para>
<para><programlisting>swift-init main stop
swift-init main start</programlisting></para>
</listitem>
</orderedlist>
<para>The following are the configurable options:
</para>
<table frame="all">
<title>proxy-server.conf Default Options in the [DEFAULT] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>bind_ip </entry>
<entry>0.0.0.0 </entry>
<entry>IP Address for server to bind</entry>
</row>
<row>
<entry>bind_port </entry>
<entry>80 </entry>
<entry>Port for server to bind </entry>
</row>
<row>
<entry>swift_dir </entry>
<entry>/etc/swift </entry>
<entry>Swift configuration directory </entry>
</row>
<row>
<entry>workers </entry>
<entry>1</entry>
<entry>Number of workers to fork </entry>
</row>
<row>
<entry>user </entry>
<entry>swift </entry>
<entry>swift user</entry>
</row>
<row>
<entry>cert_file </entry>
<entry/>
<entry>Path to the ssl .crt </entry>
</row>
<row>
<entry>key_file </entry>
<entry/>
<entry>Path to the ssl .key </entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="all">
<title>proxy-server.conf Server Options in the [proxy-server] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>use </entry>
<entry/>
<entry>paste.deploy entry point for the container server. For most cases, this should be <literal>egg:swift#container</literal>. </entry>
</row>
<row>
<entry>log_name </entry>
<entry>proxy-server </entry>
<entry>Label used when logging </entry>
</row>
<row>
<entry>log_facility </entry>
<entry>LOG_LOCAL0 </entry>
<entry>Syslog log facility </entry>
</row>
<row>
<entry>log_level </entry>
<entry>INFO </entry>
<entry>Log level </entry>
</row>
<row>
<entry>log_headers </entry>
<entry>True </entry>
<entry>If True, log headers in each request </entry>
</row>
<row>
<entry>recheck_account_existence </entry>
<entry>60 </entry>
<entry>Cache timeout in seconds to send memcached for account existence </entry>
</row>
<row>
<entry>recheck_container_existence </entry>
<entry>60 </entry>
<entry>Cache timeout in seconds to send memcached for container existence </entry>
</row>
<row>
<entry>object_chunk_size </entry>
<entry>65536 </entry>
<entry>Chunk size to read from object servers </entry>
</row>
<row>
<entry>client_chunk_size </entry>
<entry>65536 </entry>
<entry>Chunk size to read from clients </entry>
</row>
<row>
<entry>memcache_servers </entry>
<entry>127.0.0.1:11211 </entry>
<entry>Comma separated list of memcached servers ip:port </entry>
</row>
<row>
<entry>node_timeout </entry>
<entry>10 </entry>
<entry>Request timeout to external services </entry>
</row>
<row>
<entry>client_timeout </entry>
<entry>60 </entry>
<entry>Timeout to read one chunk from a client </entry>
</row>
<row>
<entry>conn_timeout </entry>
<entry>0.5 </entry>
<entry>Connection timeout to external services </entry>
</row>
<row>
<entry>error_suppression_interval </entry>
<entry>60 </entry>
<entry>Time in seconds that must elapse since the last error for a node to be considered no longer error limited </entry>
</row>
<row>
<entry>error_suppression_limit </entry>
<entry>10 </entry>
<entry>Error count to consider a node error limited </entry>
</row>
<row>
<entry>allow_account_management </entry>
<entry>false </entry>
<entry>Whether account <literal>PUT</literal>s and <literal>DELETE</literal>s are even callable </entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>Configuring Object Server</title>
<para>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.
</para>
<para>The configurable options pertaining Object Server are stored in the file <filename>/etc/swift/object-server/1.conf</filename>. The following is the sample <filename>object-server/1.conf</filename> file:</para>
<para><programlisting>[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]</programlisting></para>
<para>The following are the configurable options:
</para>
<table frame="all">
<title>object-server.conf Default Options in the [DEFAULT] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>swift_dir </entry>
<entry>/etc/swift </entry>
<entry>Swift configuration directory </entry>
</row>
<row>
<entry>devices </entry>
<entry>/srv/node </entry>
<entry>Mount parent directory where devices are mounted </entry>
</row>
<row>
<entry>mount_check </entry>
<entry>true </entry>
<entry>Whether or not check if the devices are mounted to prevent accidentally writing to the root device </entry>
</row>
<row>
<entry>bind_ip </entry>
<entry>0.0.0.0 </entry>
<entry>IP Address for server to bind</entry>
</row>
<row>
<entry>bind_port </entry>
<entry>6000 </entry>
<entry>Port for server to bind</entry>
</row>
<row>
<entry>workers </entry>
<entry>1 </entry>
<entry>Number of workers to fork </entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="all">
<title>object-server.conf Server Options in the [object-server] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>use </entry>
<entry/>
<entry>paste.deploy entry point for the object server. For most cases, this should be <literal>egg:swift#object</literal>. </entry>
</row>
<row>
<entry>log_name </entry>
<entry>object-server </entry>
<entry>log name used when logging </entry>
</row>
<row>
<entry>log_facility </entry>
<entry>LOG_LOCAL0 </entry>
<entry>Syslog log facility </entry>
</row>
<row>
<entry>log_level </entry>
<entry>INFO </entry>
<entry>Logging level </entry>
</row>
<row>
<entry>log_requests </entry>
<entry>True </entry>
<entry>Whether or not to log each request </entry>
</row>
<row>
<entry>user </entry>
<entry>swift </entry>
<entry>swift user</entry>
</row>
<row>
<entry>node_timeout </entry>
<entry>3</entry>
<entry>Request timeout to external services </entry>
</row>
<row>
<entry>conn_timeout </entry>
<entry>0.5</entry>
<entry>Connection timeout to external services </entry>
</row>
<row>
<entry>network_chunk_size </entry>
<entry>65536 </entry>
<entry>Size of chunks to read or write over the network </entry>
</row>
<row>
<entry>disk_chunk_size </entry>
<entry>65536 </entry>
<entry>Size of chunks to read or write to disk </entry>
</row>
<row>
<entry>max_upload_time </entry>
<entry>65536 </entry>
<entry>Maximum time allowed to upload an object </entry>
</row>
<row>
<entry>slow </entry>
<entry>0</entry>
<entry>If > 0, Minimum time in seconds for a <literal>PUT</literal> or <literal>DELETE</literal> request to complete </entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>Configuring Container Server</title>
<para>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.
</para>
<para>The configurable options pertaining to container server are stored in <filename>/etc/swift/container-server/1.conf</filename> file. The following is the sample <filename>container-server/1.conf</filename> file:</para>
<para><programlisting>[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]</programlisting></para>
<para>The following are the configurable options:</para>
<table frame="all">
<title>container-server.conf Default Options in the [DEFAULT] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>swift_dir </entry>
<entry>/etc/swift </entry>
<entry>Swift configuration directory </entry>
</row>
<row>
<entry>devices </entry>
<entry>/srv/node </entry>
<entry>Mount parent directory where devices are mounted </entry>
</row>
<row>
<entry>mount_check </entry>
<entry>true </entry>
<entry>Whether or not check if the devices are mounted to prevent accidentally writing to the root device </entry>
</row>
<row>
<entry>bind_ip </entry>
<entry>0.0.0.0 </entry>
<entry>IP Address for server to bind</entry>
</row>
<row>
<entry>bind_port </entry>
<entry>6001 </entry>
<entry>Port for server to bind</entry>
</row>
<row>
<entry>workers </entry>
<entry>1 </entry>
<entry>Number of workers to fork </entry>
</row>
<row>
<entry>user </entry>
<entry>swift </entry>
<entry>Swift user</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="all">
<title>container-server.conf Server Options in the [container-server] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>use </entry>
<entry/>
<entry>paste.deploy entry point for the container server. For most cases, this should be <literal>egg:swift#container</literal>. </entry>
</row>
<row>
<entry>log_name </entry>
<entry>container-server </entry>
<entry>Label used when logging </entry>
</row>
<row>
<entry>log_facility </entry>
<entry>LOG_LOCAL0 </entry>
<entry>Syslog log facility </entry>
</row>
<row>
<entry>log_level </entry>
<entry>INFO </entry>
<entry>Logging level </entry>
</row>
<row>
<entry>node_timeout </entry>
<entry>3 </entry>
<entry>Request timeout to external services </entry>
</row>
<row>
<entry>conn_timeout </entry>
<entry>0.5 </entry>
<entry>Connection timeout to external services </entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>Configuring Account Server</title>
<para>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.
</para>
<para>The configurable options pertaining to account server are stored in <filename>/etc/swift/account-server/1.conf</filename> file. The following is the sample <filename>account-server/1.conf</filename> file: </para>
<para><programlisting>[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]</programlisting></para>
<para>The following are the configurable options:</para>
<table frame="all">
<title>account-server.conf Default Options in the [DEFAULT] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>swift_dir </entry>
<entry>/etc/swift </entry>
<entry>Swift configuration directory </entry>
</row>
<row>
<entry>devices </entry>
<entry>/srv/node </entry>
<entry>mount parent directory where devices are mounted </entry>
</row>
<row>
<entry>mount_check </entry>
<entry>true </entry>
<entry>Whether or not check if the devices are mounted to prevent accidentally writing to the root device </entry>
</row>
<row>
<entry>bind_ip </entry>
<entry>0.0.0.0 </entry>
<entry>IP Address for server to bind</entry>
</row>
<row>
<entry>bind_port </entry>
<entry>6002 </entry>
<entry>Port for server to bind</entry>
</row>
<row>
<entry>workers </entry>
<entry>1 </entry>
<entry>Number of workers to fork </entry>
</row>
<row>
<entry>user </entry>
<entry>swift </entry>
<entry>Swift user</entry>
</row>
</tbody>
</tgroup>
</table>
<table frame="all">
<title>account-server.conf Server Options in the [account-server] section </title>
<tgroup cols="3">
<colspec colname="c1"/>
<colspec colname="c2"/>
<colspec colname="c3"/>
<thead>
<row>
<entry>Option </entry>
<entry>Default </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>use </entry>
<entry/>
<entry>paste.deploy entry point for the container server. For most cases, this should be <literal>egg:swift#container</literal>. </entry>
</row>
<row>
<entry>log_name </entry>
<entry>account-server </entry>
<entry>Label used when logging </entry>
</row>
<row>
<entry>log_facility </entry>
<entry>LOG_LOCAL0 </entry>
<entry>Syslog log facility </entry>
</row>
<row>
<entry>log_level </entry>
<entry>INFO </entry>
<entry>Logging level </entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section>
<title>Starting and Stopping Server</title>
<para>You must start the server manually when system reboots and whenever you update/modify the configuration files.</para>
<itemizedlist>
<listitem>
<para>To start the server, enter the following command:</para>
<para><command># swift_init main start</command></para>
</listitem>
<listitem>
<para>To stop the server, enter the following command:</para>
<para><command># swift_init main stop</command></para>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Working with Unified File and Object Storage</title>
<para>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 <filename>X-Storage-URL HTTP</filename> header obtained during
successful authentication.
</para>
<section>
<title>Configuring Authenticated Access </title>
<para>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.
</para>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To authenticate, run the following command:
</para>
<programlisting>GET auth/v1.0 HTTP/1.1
Host: <auth URL>
X-Auth-User: <account name>:<user name>
X-Auth-Key: <user-Password></programlisting>
<para>For example,
</para>
<programlisting>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</programlisting>
<para>To authenticate access using cURL (for the above example), run the following
command:
</para>
<programlisting>curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass:testing' -k
https://auth.example.com:443/auth/v1.0</programlisting>
<para>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.
</para>
</listitem>
</itemizedlist>
<note>
<para>The authentication tokens are valid for a 24 hour period.
</para>
</note>
</section>
<section>
<title>Working with Accounts </title>
<para>This section describes the list of operations you can perform at the account level of the URL.
</para>
<section>
<title>Displaying Container Information </title>
<para>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:
</para>
<para><informaltable frame="none">
<tgroup cols="2">
<colspec colnum="1" colname="c0" colsep="0"/>
<colspec colnum="2" colname="c1" colsep="0"/>
<thead>
<row>
<entry>Parameter </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>limit </entry>
<entry>Limits the number of results to at most <emphasis role="italic">n</emphasis> value. </entry>
</row>
<row>
<entry>marker </entry>
<entry>Returns object names greater in value than the specified marker. </entry>
</row>
<row>
<entry>format </entry>
<entry>Specify either json or xml to return the respective serialized response. </entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para><emphasis role="bold">To display container information </emphasis></para>
<itemizedlist>
<listitem>
<para>List all the containers of an account using the following command:
</para>
<para><programlisting>GET /<apiversion>/<account> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting></para>
<para>For example,
</para>
<programlisting>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</programlisting>
</listitem>
</itemizedlist>
<para>To display container information using cURL (for the above example), run the following
command:
</para>
<para><programlisting>curl -v -X GET -H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test -k</programlisting></para>
</section>
<section>
<title>Displaying Account Metadata Information </title>
<para>You can issue HEAD command to the storage service to view the number of containers and the total
bytes stored in the account.
</para>
<itemizedlist>
<listitem>
<para>To display containers and storage used, run the following command:
</para>
<programlisting>HEAD /<apiversion>/<account> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting>
<para>For example,
</para>
<programlisting>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</programlisting>
<para>To display account metadata information using cURL (for the above example), run the following
command:
</para>
<programlisting>curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test -k</programlisting>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Working with Containers </title>
<para>This section describes the list of operations you can perform at the container level of the URL.
</para>
<section>
<title> Creating Containers </title>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To create a container, run the following command:
</para>
<programlisting>PUT /<apiversion>/<account>/<container>/ HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting>
<para>For example,
</para>
<programlisting>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</programlisting>
<para>To create container using cURL (for the above example), run the following command:
</para>
<programlisting>curl -v -X PUT -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures -k</programlisting>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Displaying Objects of a Container </title>
<para>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:
</para>
<para><informaltable frame="none">
<tgroup cols="2">
<colspec colnum="1" colname="c0" colsep="0"/>
<colspec colnum="2" colname="c1" colsep="0"/>
<thead>
<row>
<entry>Parameter </entry>
<entry>Description </entry>
</row>
</thead>
<tbody>
<row>
<entry>limit </entry>
<entry>Limits the number of results to at most <emphasis role="italic">n</emphasis> value. </entry>
</row>
<row>
<entry>marker </entry>
<entry>Returns object names greater in value than the specified marker. </entry>
</row>
<row>
<entry>prefix </entry>
<entry>Displays the results limited to object names beginning with the substring x. beginning with the substring x. </entry>
</row>
<row>
<entry>path </entry>
<entry>Returns the object names nested in the pseudo path. </entry>
</row>
<row>
<entry>format </entry>
<entry>Specify either json or xml to return the respective serialized response. </entry>
</row>
<row>
<entry>delimiter </entry>
<entry>Returns all the object names nested in the container. </entry>
</row>
</tbody>
</tgroup>
</informaltable></para>
<para>To display objects of a container
</para>
<itemizedlist>
<listitem>
<para>List objects of a specific container using the following command:
</para>
</listitem>
</itemizedlist>
<programlisting>GET /<apiversion>/<account>/<container>[parm=value] HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting>
<para>For example,
</para>
<programlisting>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</programlisting>
<para>To display objects of a container using cURL (for the above example), run the following
command:
</para>
<programlisting>curl -v -X GET-H 'X-Auth-Token: AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images -k</programlisting>
</section>
<section>
<title>Displaying Container Metadata Information </title>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To display list of objects and storage used, run the following command:
</para>
<programlisting>HEAD /<apiversion>/<account>/<container> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting>
<para>For example,</para>
<programlisting>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</programlisting>
<para>To display list of objects and storage used in a container using cURL (for the above example), run
the following command:
</para>
<programlisting>curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images -k</programlisting>
</listitem>
</itemizedlist>
</section>
<section>
<title>Deleting Container </title>
<para>You can use DELETE command to permanently delete containers. The container must be empty
before it can be deleted.
</para>
<para>You can issue HEAD command to determine if it contains any objects.
</para>
<itemizedlist>
<listitem>
<para>To delete a container, run the following command:
</para>
<programlisting>DELETE /<apiversion>/<account>/<container>/ HTTP/1.1
Host: <storage URL>
X-Auth-Token: <authentication-token-key></programlisting>
<para>For example,</para>
<programlisting>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</programlisting>
<para>To delete a container using cURL (for the above example), run the following command:
</para>
<programlisting>curl -v -X DELETE -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures -k</programlisting>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Updating Container Metadata </title>
<para>You can update the metadata of container using POST operation, metadata keys should be prefixed
with 'x-container-meta'.
</para>
<itemizedlist>
<listitem>
<para>To update the metadata of the object, run the following command:
</para>
<programlisting>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></programlisting>
<para>For example,
</para>
<para><programlisting>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</programlisting></para>
<para>To update the metadata of the object using cURL (for the above example), run the following
command:
</para>
<para><programlisting>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</programlisting></para>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
<section id="chap-Administration_Guide-Working_UFO-Setting_ACLs">
<title> Setting ACLs on Container </title>
<para>You can set the container access control list by using POST command on container with <command>x- container-read</command> and<command> x-container-write</command> keys.
</para>
<para>The ACL format is <command>[item[,item...]]</command>. 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.
</para>
<para>The referrer designation format is:<command> .r:[-]value</command>.
</para>
<para>The .r can also be <command>.ref, .referer, </command>or .<command>referrer</command>; though it will be shortened to.r for
decreased character count usage. The value can be <command>*</command> to specify any referrer host is allowed access. The leading minus sign (-)
indicates referrer hosts that should be denied access.
</para>
<para>Examples of valid ACLs:
</para>
<para><programlisting>.r:*
.r:*,bobs_account,sues_account:sue
bobs_account,sues_account:sue</programlisting></para>
<para>Examples of invalid ACLs:</para>
<para><programlisting>.r:
.r:-</programlisting></para>
<para>By default, allowing read access via <command><command>.</command>r </command>will not allow listing objects in the container but allows
retrieving objects from the container. To turn on listings, use the .<command>rlistings</command> directive. Also, <command>.r</command>
designations are not allowed in headers whose names include the word write.
</para>
<para>For example, to set all the objects access rights to "public‟ inside the container using cURL (for the
above example), run the following command:
</para>
<para><programlisting>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</programlisting></para>
</section>
</section>
<section>
<title> Working with Objects </title>
<para>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.
</para>
<para>This section describes the list of operations you can perform at the object level of the URL.
</para>
<section>
<title>Creating or Updating Object </title>
<para>You can use PUT command to write or update an object's content and metadata.
</para>
<para>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.
</para>
<para>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<command>X-Object- Meta</command>- prefix.
</para>
<itemizedlist>
<listitem>
<para>To create or update an object, run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>For example,</para>
<para><programlisting>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</programlisting></para>
<para>To create or update an object using cURL (for the above example), run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>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.
</para>
</listitem>
</itemizedlist>
<section>
<title>Chunked Transfer Encoding </title>
<para>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.
</para>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To create or update an object, run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>For example,
</para>
<para><programlisting>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</programlisting>
</para>
</listitem>
</itemizedlist>
</section>
</section>
<section>
<title>Copying Object </title>
<para>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.
</para>
<para><emphasis role="bold">To copy object from one container to another </emphasis></para>
<itemizedlist>
<listitem>
<para>To add a new object and designate the source of the data from another container, run the
following command:
</para>
<para><programlisting>COPY /<apiversion>/<account>/<container>/<sourceobject> HTTP/1.1
Host: <storage URL>
X-Auth-Token: < authentication-token-key>
Destination: /<container>/<destinationobject></programlisting></para>
<para>For example,
</para>
<para><programlisting>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</programlisting></para>
<para>To copy an object using cURL (for the above example), run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>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.
</para>
<para>You can also use PUT command to copy object by using additional header <command>X-Copy-From: container/obj</command>.
</para>
</listitem>
<listitem>
<para>To use PUT command to copy an object, run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>To copy an object using cURL (for the above example), run the following command:
</para>
<para><programlisting>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</programlisting></para>
<para>The status code of 201 (Created) indicates that you have successfully copied the object.
</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Displaying Object Information </title>
<para>You can issue GET command on an object to view the object data of the object.
</para>
<itemizedlist>
<listitem>
<para>To display the content of an object run the following command:</para>
<para><programlisting>GET /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key></programlisting></para>
<para>For example,
</para>
<para><programlisting>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
[.........]</programlisting></para>
<para>To display the content of an object using cURL (for the above example), run the following
command:
</para>
<para><programlisting>curl -v -X GET -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images/cat -k</programlisting></para>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Displaying Object Metadata </title>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To display the metadata of the object, run the following command:
</para>
</listitem>
</itemizedlist>
<para><programlisting>HEAD /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key></programlisting></para>
<para>For example,
</para>
<para><programlisting>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</programlisting></para>
<para>To display the metadata of the object using cURL (for the above example), run the following
command:
</para>
<para><programlisting>curl -v -X HEAD -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/images/cat -k</programlisting></para>
<para>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.
</para>
</section>
<section>
<title>Updating Object Metadata </title>
<para>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.
</para>
<para>You must prefix <emphasis role="bold">X-Object-Meta-</emphasis> to the key names.
</para>
<itemizedlist>
<listitem>
<para>To update the metadata of an object, run the following command:</para>
<para><programlisting>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></programlisting>
</para>
<para>For example,
</para>
<para><programlisting>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</programlisting></para>
<para>To update the metadata of an object using cURL (for the above example), run the following
command:
</para>
<para><programlisting>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</programlisting></para>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
<section>
<title>Deleting Object </title>
<para>You can use DELETE command to permanently delete the object.
</para>
<para>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.
</para>
<itemizedlist>
<listitem>
<para>To delete an object, run the following command:
</para>
<para><programlisting>DELETE /<apiversion>/<account>/<container>/<object> HTTP/1.1
Host: <storage URL>
X-Auth-Token: <Authentication-token-key></programlisting></para>
<para>For example,
</para>
<para><programlisting>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</programlisting></para>
<para>To delete an object using cURL (for the above example), run the following command:
</para>
<para><programlisting>curl -v -X DELETE -H 'X-Auth-Token:
AUTH_tkde3ad38b087b49bbbac0494f7600a554'
https://example.storage.com:443/v1/AUTH_test/pictures/cat -k</programlisting></para>
<para>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.
</para>
</listitem>
</itemizedlist>
</section>
</section>
</section>
</chapter>
|