]> git.proxmox.com Git - ceph.git/blame - ceph/doc/radosgw/placement.rst
import quincy beta 17.1.0
[ceph.git] / ceph / doc / radosgw / placement.rst
CommitLineData
11fdf7f2
TL
1==================================
2Pool Placement and Storage Classes
3==================================
a8e16298
TL
4
5.. contents::
6
7Placement Targets
8=================
9
10.. versionadded:: Jewel
11
12Placement targets control which `Pools`_ are associated with a particular
13bucket. A bucket's placement target is selected on creation, and cannot be
14modified. The ``radosgw-admin bucket stats`` command will display its
15``placement_rule``.
16
17The zonegroup configuration contains a list of placement targets with an
18initial target named ``default-placement``. The zone configuration then maps
19each zonegroup placement target name onto its local storage. This zone
20placement information includes the ``index_pool`` name for the bucket index,
21the ``data_extra_pool`` name for metadata about incomplete multipart uploads,
11fdf7f2
TL
22and a ``data_pool`` name for each storage class.
23
24.. _storage_classes:
25
26Storage Classes
27===============
28
29.. versionadded:: Nautilus
30
31Storage classes are used to customize the placement of object data. S3 Bucket
32Lifecycle rules can automate the transition of objects between storage classes.
33
34Storage classes are defined in terms of placement targets. Each zonegroup
35placement target lists its available storage classes with an initial class
36named ``STANDARD``. The zone configuration is responsible for providing a
37``data_pool`` pool name for each of the zonegroup's storage classes.
a8e16298
TL
38
39Zonegroup/Zone Configuration
40============================
41
42Placement configuration is performed with ``radosgw-admin`` commands on
43the zonegroups and zones.
44
45The zonegroup placement configuration can be queried with:
46
47::
48
49 $ radosgw-admin zonegroup get
50 {
51 "id": "ab01123f-e0df-4f29-9d71-b44888d67cd5",
52 "name": "default",
53 "api_name": "default",
54 ...
55 "placement_targets": [
56 {
57 "name": "default-placement",
58 "tags": [],
11fdf7f2
TL
59 "storage_classes": [
60 "STANDARD"
61 ]
a8e16298
TL
62 }
63 ],
64 "default_placement": "default-placement",
65 ...
66 }
67
68The zone placement configuration can be queried with:
69
70::
71
72 $ radosgw-admin zone get
73 {
74 "id": "557cdcee-3aae-4e9e-85c7-2f86f5eddb1f",
75 "name": "default",
76 "domain_root": "default.rgw.meta:root",
77 ...
78 "placement_pools": [
79 {
80 "key": "default-placement",
81 "val": {
82 "index_pool": "default.rgw.buckets.index",
11fdf7f2
TL
83 "storage_classes": {
84 "STANDARD": {
85 "data_pool": "default.rgw.buckets.data"
86 }
87 },
a8e16298
TL
88 "data_extra_pool": "default.rgw.buckets.non-ec",
89 "index_type": 0
90 }
91 }
92 ],
93 ...
94 }
95
96.. note:: If you have not done any previous `Multisite Configuration`_,
97 a ``default`` zone and zonegroup are created for you, and changes
98 to the zone/zonegroup will not take effect until the Ceph Object
99 Gateways are restarted. If you have created a realm for multisite,
100 the zone/zonegroup changes will take effect once the changes are
101 committed with ``radosgw-admin period update --commit``.
102
103Adding a Placement Target
104-------------------------
105
106To create a new placement target named ``temporary``, start by adding it to
107the zonegroup:
108
109::
110
111 $ radosgw-admin zonegroup placement add \
112 --rgw-zonegroup default \
113 --placement-id temporary
114
115Then provide the zone placement info for that target:
116
117::
118
119 $ radosgw-admin zone placement add \
120 --rgw-zone default \
121 --placement-id temporary \
122 --data-pool default.rgw.temporary.data \
123 --index-pool default.rgw.temporary.index \
11fdf7f2
TL
124 --data-extra-pool default.rgw.temporary.non-ec
125
20effc67
TL
126.. _adding_a_storage_class:
127
11fdf7f2
TL
128Adding a Storage Class
129----------------------
130
f67539c2 131To add a new storage class named ``GLACIER`` to the ``default-placement`` target,
11fdf7f2
TL
132start by adding it to the zonegroup:
133
134::
135
136 $ radosgw-admin zonegroup placement add \
137 --rgw-zonegroup default \
138 --placement-id default-placement \
f67539c2 139 --storage-class GLACIER
11fdf7f2
TL
140
141Then provide the zone placement info for that storage class:
142
143::
144
145 $ radosgw-admin zone placement add \
146 --rgw-zone default \
147 --placement-id default-placement \
f67539c2
TL
148 --storage-class GLACIER \
149 --data-pool default.rgw.glacier.data \
a8e16298
TL
150 --compression lz4
151
152Customizing Placement
153=====================
154
155Default Placement
156-----------------
157
158By default, new buckets will use the zonegroup's ``default_placement`` target.
159This zonegroup setting can be changed with:
160
161::
162
163 $ radosgw-admin zonegroup placement default \
164 --rgw-zonegroup default \
165 --placement-id new-placement
166
167User Placement
168--------------
169
170A Ceph Object Gateway user can override the zonegroup's default placement
171target by setting a non-empty ``default_placement`` field in the user info.
11fdf7f2
TL
172Similarly, the ``default_storage_class`` can override the ``STANDARD``
173storage class applied to objects by default.
a8e16298
TL
174
175::
176
177 $ radosgw-admin user info --uid testid
178 {
179 ...
180 "default_placement": "",
11fdf7f2 181 "default_storage_class": "",
a8e16298
TL
182 "placement_tags": [],
183 ...
184 }
185
186If a zonegroup's placement target contains any ``tags``, users will be unable
187to create buckets with that placement target unless their user info contains
188at least one matching tag in its ``placement_tags`` field. This can be useful
189to restrict access to certain types of storage.
190
9f95a23c 191The ``radosgw-admin`` command can modify these fields directly with:
a8e16298
TL
192
193::
194
9f95a23c
TL
195 $ radosgw-admin user modify \
196 --uid <user-id> \
197 --placement-id <default-placement-id> \
198 --storage-class <default-storage-class> \
199 --tags <tag1,tag2>
a8e16298 200
81eedcae
TL
201.. _s3_bucket_placement:
202
a8e16298
TL
203S3 Bucket Placement
204-------------------
205
206When creating a bucket with the S3 protocol, a placement target can be
207provided as part of the LocationConstraint to override the default placement
208targets from the user and zonegroup.
209
210Normally, the LocationConstraint must match the zonegroup's ``api_name``:
211
212::
213
214 <LocationConstraint>default</LocationConstraint>
215
216A custom placement target can be added to the ``api_name`` following a colon:
217
218::
219
220 <LocationConstraint>default:new-placement</LocationConstraint>
221
222Swift Bucket Placement
223----------------------
224
225When creating a bucket with the Swift protocol, a placement target can be
226provided in the HTTP header ``X-Storage-Policy``:
227
228::
229
230 X-Storage-Policy: new-placement
231
11fdf7f2
TL
232Using Storage Classes
233=====================
234
235All placement targets have a ``STANDARD`` storage class which is applied to
236new objects by default. The user can override this default with its
237``default_storage_class``.
238
239To create an object in a non-default storage class, provide that storage class
240name in an HTTP header with the request. The S3 protocol uses the
241``X-Amz-Storage-Class`` header, while the Swift protocol uses the
242``X-Object-Storage-Class`` header.
243
20effc67
TL
244When using AWS S3 SDKs such as ``boto3``, it is important that non-default
245storage class names match those provided by AWS S3, or else the SDK
f67539c2
TL
246will drop the request and raise an exception.
247
11fdf7f2
TL
248S3 Object Lifecycle Management can then be used to move object data between
249storage classes using ``Transition`` actions.
250
a8e16298
TL
251.. _`Pools`: ../pools
252.. _`Multisite Configuration`: ../multisite