]> git.proxmox.com Git - ceph.git/blame - ceph/doc/radosgw/placement.rst
import 15.2.0 Octopus source
[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
126Adding a Storage Class
127----------------------
128
129To add a new storage class named ``COLD`` to the ``default-placement`` target,
130start by adding it to the zonegroup:
131
132::
133
134 $ radosgw-admin zonegroup placement add \
135 --rgw-zonegroup default \
136 --placement-id default-placement \
137 --storage-class COLD
138
139Then provide the zone placement info for that storage class:
140
141::
142
143 $ radosgw-admin zone placement add \
144 --rgw-zone default \
145 --placement-id default-placement \
146 --storage-class COLD \
147 --data-pool default.rgw.cold.data \
a8e16298
TL
148 --compression lz4
149
150Customizing Placement
151=====================
152
153Default Placement
154-----------------
155
156By default, new buckets will use the zonegroup's ``default_placement`` target.
157This zonegroup setting can be changed with:
158
159::
160
161 $ radosgw-admin zonegroup placement default \
162 --rgw-zonegroup default \
163 --placement-id new-placement
164
165User Placement
166--------------
167
168A Ceph Object Gateway user can override the zonegroup's default placement
169target by setting a non-empty ``default_placement`` field in the user info.
11fdf7f2
TL
170Similarly, the ``default_storage_class`` can override the ``STANDARD``
171storage class applied to objects by default.
a8e16298
TL
172
173::
174
175 $ radosgw-admin user info --uid testid
176 {
177 ...
178 "default_placement": "",
11fdf7f2 179 "default_storage_class": "",
a8e16298
TL
180 "placement_tags": [],
181 ...
182 }
183
184If a zonegroup's placement target contains any ``tags``, users will be unable
185to create buckets with that placement target unless their user info contains
186at least one matching tag in its ``placement_tags`` field. This can be useful
187to restrict access to certain types of storage.
188
9f95a23c 189The ``radosgw-admin`` command can modify these fields directly with:
a8e16298
TL
190
191::
192
9f95a23c
TL
193 $ radosgw-admin user modify \
194 --uid <user-id> \
195 --placement-id <default-placement-id> \
196 --storage-class <default-storage-class> \
197 --tags <tag1,tag2>
a8e16298 198
81eedcae
TL
199.. _s3_bucket_placement:
200
a8e16298
TL
201S3 Bucket Placement
202-------------------
203
204When creating a bucket with the S3 protocol, a placement target can be
205provided as part of the LocationConstraint to override the default placement
206targets from the user and zonegroup.
207
208Normally, the LocationConstraint must match the zonegroup's ``api_name``:
209
210::
211
212 <LocationConstraint>default</LocationConstraint>
213
214A custom placement target can be added to the ``api_name`` following a colon:
215
216::
217
218 <LocationConstraint>default:new-placement</LocationConstraint>
219
220Swift Bucket Placement
221----------------------
222
223When creating a bucket with the Swift protocol, a placement target can be
224provided in the HTTP header ``X-Storage-Policy``:
225
226::
227
228 X-Storage-Policy: new-placement
229
11fdf7f2
TL
230Using Storage Classes
231=====================
232
233All placement targets have a ``STANDARD`` storage class which is applied to
234new objects by default. The user can override this default with its
235``default_storage_class``.
236
237To create an object in a non-default storage class, provide that storage class
238name in an HTTP header with the request. The S3 protocol uses the
239``X-Amz-Storage-Class`` header, while the Swift protocol uses the
240``X-Object-Storage-Class`` header.
241
242S3 Object Lifecycle Management can then be used to move object data between
243storage classes using ``Transition`` actions.
244
a8e16298
TL
245.. _`Pools`: ../pools
246.. _`Multisite Configuration`: ../multisite