]>
Commit | Line | Data |
---|---|---|
80c0adcb | 1 | [[chapter_pveceph]] |
0840a663 | 2 | ifdef::manvolnum[] |
b2f242ab DM |
3 | pveceph(1) |
4 | ========== | |
404a158e | 5 | :pve-toplevel: |
0840a663 DM |
6 | |
7 | NAME | |
8 | ---- | |
9 | ||
21394e70 | 10 | pveceph - Manage Ceph Services on Proxmox VE Nodes |
0840a663 | 11 | |
49a5e11c | 12 | SYNOPSIS |
0840a663 DM |
13 | -------- |
14 | ||
15 | include::pveceph.1-synopsis.adoc[] | |
16 | ||
17 | DESCRIPTION | |
18 | ----------- | |
19 | endif::manvolnum[] | |
0840a663 | 20 | ifndef::manvolnum[] |
4bfe3e35 TL |
21 | Deploy Hyper-Converged Ceph Cluster |
22 | =================================== | |
49d3ad91 | 23 | :pve-toplevel: |
3885be3b TL |
24 | |
25 | Introduction | |
26 | ------------ | |
0840a663 DM |
27 | endif::manvolnum[] |
28 | ||
94d7a98c | 29 | [thumbnail="screenshot/gui-ceph-status-dashboard.png"] |
8997dd6e | 30 | |
40e6c806 | 31 | {pve} unifies your compute and storage systems, that is, you can use the same |
a474ca1f AA |
32 | physical nodes within a cluster for both computing (processing VMs and |
33 | containers) and replicated storage. The traditional silos of compute and | |
34 | storage resources can be wrapped up into a single hyper-converged appliance. | |
40e6c806 | 35 | Separate storage networks (SANs) and connections via network attached storage |
a474ca1f AA |
36 | (NAS) disappear. With the integration of Ceph, an open source software-defined |
37 | storage platform, {pve} has the ability to run and manage Ceph storage directly | |
38 | on the hypervisor nodes. | |
c994e4e5 DM |
39 | |
40 | Ceph is a distributed object store and file system designed to provide | |
1d54c3b4 AA |
41 | excellent performance, reliability and scalability. |
42 | ||
04ba9b24 | 43 | .Some advantages of Ceph on {pve} are: |
40e6c806 | 44 | - Easy setup and management via CLI and GUI |
a474ca1f | 45 | - Thin provisioning |
40e6c806 | 46 | - Snapshot support |
a474ca1f | 47 | - Self healing |
a474ca1f | 48 | - Scalable to the exabyte level |
3885be3b | 49 | - Provides block, file system, and object storage |
a474ca1f AA |
50 | - Setup pools with different performance and redundancy characteristics |
51 | - Data is replicated, making it fault tolerant | |
40e6c806 | 52 | - Runs on commodity hardware |
a474ca1f | 53 | - No need for hardware RAID controllers |
a474ca1f AA |
54 | - Open source |
55 | ||
3885be3b TL |
56 | For small to medium-sized deployments, it is possible to install a Ceph server |
57 | for using RADOS Block Devices (RBD) or CephFS directly on your {pve} cluster | |
58 | nodes (see xref:ceph_rados_block_devices[Ceph RADOS Block Devices (RBD)]). | |
59 | Recent hardware has a lot of CPU power and RAM, so running storage services and | |
60 | virtual guests on the same node is possible. | |
21394e70 | 61 | |
3885be3b TL |
62 | To simplify management, {pve} provides you native integration to install and |
63 | manage {ceph} services on {pve} nodes either via the built-in web interface, or | |
64 | using the 'pveceph' command line tool. | |
21394e70 | 65 | |
3885be3b TL |
66 | |
67 | Terminology | |
68 | ----------- | |
69 | ||
70 | // TODO: extend and also describe basic architecture here. | |
40e6c806 | 71 | .Ceph consists of multiple Daemons, for use as an RBD storage: |
3885be3b TL |
72 | - Ceph Monitor (ceph-mon, or MON) |
73 | - Ceph Manager (ceph-mgr, or MGS) | |
74 | - Ceph Metadata Service (ceph-mds, or MDS) | |
75 | - Ceph Object Storage Daemon (ceph-osd, or OSD) | |
1d54c3b4 | 76 | |
d241b01b | 77 | TIP: We highly recommend to get familiar with Ceph |
b46a49ed | 78 | footnote:[Ceph intro {cephdocs-url}/start/intro/], |
d241b01b | 79 | its architecture |
b46a49ed | 80 | footnote:[Ceph architecture {cephdocs-url}/architecture/] |
477fbcfb | 81 | and vocabulary |
b46a49ed | 82 | footnote:[Ceph glossary {cephdocs-url}/glossary]. |
1d54c3b4 | 83 | |
21394e70 | 84 | |
3885be3b TL |
85 | Recommendations for a Healthy Ceph Cluster |
86 | ------------------------------------------ | |
21394e70 | 87 | |
3885be3b TL |
88 | To build a hyper-converged Proxmox + Ceph Cluster, you must use at least three |
89 | (preferably) identical servers for the setup. | |
21394e70 DM |
90 | |
91 | Check also the recommendations from | |
b46a49ed | 92 | {cephdocs-url}/start/hardware-recommendations/[Ceph's website]. |
21394e70 | 93 | |
3885be3b TL |
94 | NOTE: The recommendations below should be seen as a rough guidance for choosing |
95 | hardware. Therefore, it is still essential to adapt it to your specific needs. | |
96 | You should test your setup and monitor health and performance continuously. | |
97 | ||
76f6eca4 | 98 | .CPU |
3885be3b TL |
99 | Ceph services can be classified into two categories: |
100 | * Intensive CPU usage, benefiting from high CPU base frequencies and multiple | |
101 | cores. Members of that category are: | |
102 | ** Object Storage Daemon (OSD) services | |
103 | ** Meta Data Service (MDS) used for CephFS | |
104 | * Moderate CPU usage, not needing multiple CPU cores. These are: | |
105 | ** Monitor (MON) services | |
106 | ** Manager (MGR) services | |
107 | ||
108 | As a simple rule of thumb, you should assign at least one CPU core (or thread) | |
109 | to each Ceph service to provide the minimum resources required for stable and | |
110 | durable Ceph performance. | |
111 | ||
112 | For example, if you plan to run a Ceph monitor, a Ceph manager and 6 Ceph OSDs | |
113 | services on a node you should reserve 8 CPU cores purely for Ceph when targeting | |
114 | basic and stable performance. | |
115 | ||
116 | Note that OSDs CPU usage depend mostly from the disks performance. The higher | |
117 | the possible IOPS (**IO** **O**perations per **S**econd) of a disk, the more CPU | |
118 | can be utilized by a OSD service. | |
119 | For modern enterprise SSD disks, like NVMe's that can permanently sustain a high | |
120 | IOPS load over 100'000 with sub millisecond latency, each OSD can use multiple | |
121 | CPU threads, e.g., four to six CPU threads utilized per NVMe backed OSD is | |
122 | likely for very high performance disks. | |
76f6eca4 AA |
123 | |
124 | .Memory | |
125 | Especially in a hyper-converged setup, the memory consumption needs to be | |
3885be3b TL |
126 | carefully planned out and monitored. In addition to the predicted memory usage |
127 | of virtual machines and containers, you must also account for having enough | |
128 | memory available for Ceph to provide excellent and stable performance. | |
5b502340 AA |
129 | |
130 | As a rule of thumb, for roughly **1 TiB of data, 1 GiB of memory** will be used | |
3885be3b TL |
131 | by an OSD. While the usage might be less under normal conditions, it will use |
132 | most during critical operations like recovery, re-balancing or backfilling. | |
133 | That means that you should avoid maxing out your available memory already on | |
134 | normal operation, but rather leave some headroom to cope with outages. | |
5b502340 | 135 | |
3885be3b TL |
136 | The OSD service itself will use additional memory. The Ceph BlueStore backend of |
137 | the daemon requires by default **3-5 GiB of memory**, b (adjustable). | |
76f6eca4 AA |
138 | |
139 | .Network | |
3885be3b TL |
140 | We recommend a network bandwidth of at least 10 Gbps, or more, to be used |
141 | exclusively for Ceph traffic. A meshed network setup | |
76f6eca4 | 142 | footnote:[Full Mesh Network for Ceph {webwiki-url}Full_Mesh_Network_for_Ceph_Server] |
3885be3b TL |
143 | is also an option for three to five node clusters, if there are no 10+ Gbps |
144 | switches available. | |
145 | ||
146 | [IMPORTANT] | |
147 | The volume of traffic, especially during recovery, will interfere | |
148 | with other services on the same network, especially the latency sensitive {pve} | |
149 | corosync cluster stack can be affected, resulting in possible loss of cluster | |
150 | quorum. Moving the Ceph traffic to dedicated and physical separated networks | |
151 | will avoid such interference, not only for corosync, but also for the networking | |
152 | services provided by any virtual guests. | |
153 | ||
154 | For estimating your bandwidth needs, you need to take the performance of your | |
155 | disks into account.. While a single HDD might not saturate a 1 Gb link, multiple | |
156 | HDD OSDs per node can already saturate 10 Gbps too. | |
157 | If modern NVMe-attached SSDs are used, a single one can already saturate 10 Gbps | |
158 | of bandwidth, or more. For such high-performance setups we recommend at least | |
159 | a 25 Gpbs, while even 40 Gbps or 100+ Gbps might be required to utilize the full | |
160 | performance potential of the underlying disks. | |
161 | ||
162 | If unsure, we recommend using three (physical) separate networks for | |
163 | high-performance setups: | |
164 | * one very high bandwidth (25+ Gbps) network for Ceph (internal) cluster | |
165 | traffic. | |
166 | * one high bandwidth (10+ Gpbs) network for Ceph (public) traffic between the | |
167 | ceph server and ceph client storage traffic. Depending on your needs this can | |
168 | also be used to host the virtual guest traffic and the VM live-migration | |
169 | traffic. | |
170 | * one medium bandwidth (1 Gbps) exclusive for the latency sensitive corosync | |
171 | cluster communication. | |
76f6eca4 AA |
172 | |
173 | .Disks | |
174 | When planning the size of your Ceph cluster, it is important to take the | |
40e6c806 | 175 | recovery time into consideration. Especially with small clusters, recovery |
76f6eca4 AA |
176 | might take long. It is recommended that you use SSDs instead of HDDs in small |
177 | setups to reduce recovery time, minimizing the likelihood of a subsequent | |
178 | failure event during recovery. | |
179 | ||
3a433e9b | 180 | In general, SSDs will provide more IOPS than spinning disks. With this in mind, |
40e6c806 DW |
181 | in addition to the higher cost, it may make sense to implement a |
182 | xref:pve_ceph_device_classes[class based] separation of pools. Another way to | |
183 | speed up OSDs is to use a faster disk as a journal or | |
513e2f57 TL |
184 | DB/**W**rite-**A**head-**L**og device, see |
185 | xref:pve_ceph_osds[creating Ceph OSDs]. | |
186 | If a faster disk is used for multiple OSDs, a proper balance between OSD | |
40e6c806 DW |
187 | and WAL / DB (or journal) disk must be selected, otherwise the faster disk |
188 | becomes the bottleneck for all linked OSDs. | |
189 | ||
3885be3b TL |
190 | Aside from the disk type, Ceph performs best with an evenly sized, and an evenly |
191 | distributed amount of disks per node. For example, 4 x 500 GB disks within each | |
192 | node is better than a mixed setup with a single 1 TB and three 250 GB disk. | |
2f19a6b0 | 193 | |
40e6c806 DW |
194 | You also need to balance OSD count and single OSD capacity. More capacity |
195 | allows you to increase storage density, but it also means that a single OSD | |
196 | failure forces Ceph to recover more data at once. | |
76f6eca4 | 197 | |
a474ca1f | 198 | .Avoid RAID |
86be506d | 199 | As Ceph handles data object redundancy and multiple parallel writes to disks |
c78756be | 200 | (OSDs) on its own, using a RAID controller normally doesn’t improve |
86be506d | 201 | performance or availability. On the contrary, Ceph is designed to handle whole |
40e6c806 DW |
202 | disks on it's own, without any abstraction in between. RAID controllers are not |
203 | designed for the Ceph workload and may complicate things and sometimes even | |
86be506d TL |
204 | reduce performance, as their write and caching algorithms may interfere with |
205 | the ones from Ceph. | |
a474ca1f | 206 | |
40e6c806 | 207 | WARNING: Avoid RAID controllers. Use host bus adapter (HBA) instead. |
a474ca1f | 208 | |
2394c306 | 209 | [[pve_ceph_install_wizard]] |
40e6c806 | 210 | Initial Ceph Installation & Configuration |
2394c306 TM |
211 | ----------------------------------------- |
212 | ||
513e2f57 TL |
213 | Using the Web-based Wizard |
214 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
215 | ||
2394c306 TM |
216 | [thumbnail="screenshot/gui-node-ceph-install.png"] |
217 | ||
218 | With {pve} you have the benefit of an easy to use installation wizard | |
219 | for Ceph. Click on one of your cluster nodes and navigate to the Ceph | |
40e6c806 DW |
220 | section in the menu tree. If Ceph is not already installed, you will see a |
221 | prompt offering to do so. | |
2394c306 | 222 | |
40e6c806 | 223 | The wizard is divided into multiple sections, where each needs to |
513e2f57 TL |
224 | finish successfully, in order to use Ceph. |
225 | ||
226 | First you need to chose which Ceph version you want to install. Prefer the one | |
227 | from your other nodes, or the newest if this is the first node you install | |
228 | Ceph. | |
229 | ||
230 | After starting the installation, the wizard will download and install all the | |
231 | required packages from {pve}'s Ceph repository. | |
94d7a98c | 232 | [thumbnail="screenshot/gui-node-ceph-install-wizard-step0.png"] |
2394c306 | 233 | |
513e2f57 | 234 | After finishing the installation step, you will need to create a configuration. |
6a711e64 TL |
235 | This step is only needed once per cluster, as this configuration is distributed |
236 | automatically to all remaining cluster members through {pve}'s clustered | |
237 | xref:chapter_pmxcfs[configuration file system (pmxcfs)]. | |
2394c306 TM |
238 | |
239 | The configuration step includes the following settings: | |
240 | ||
7367ba5b TL |
241 | [[pve_ceph_wizard_networks]] |
242 | ||
243 | * *Public Network:* This network will be used for public storage communication | |
244 | (e.g., for virtual machines using a Ceph RBD backed disk, or a CephFS mount). | |
245 | This setting is required. | |
246 | + | |
247 | Separating your Ceph traffic from cluster communication, and possible the | |
248 | front-facing (public) networks of your virtual gusts, is highly recommended. | |
249 | Otherwise, Ceph's high-bandwidth IO-traffic could cause interference with | |
250 | other low-latency dependent services. | |
2394c306 TM |
251 | |
252 | [thumbnail="screenshot/gui-node-ceph-install-wizard-step2.png"] | |
253 | ||
7367ba5b TL |
254 | * *Cluster Network:* Specify to separate the xref:pve_ceph_osds[OSD] replication |
255 | and heartbeat traffic as well. | |
256 | + | |
257 | Using a physically separated network is recommended, as it will relieve the | |
258 | Ceph public and the virtual guests network, while also providing a significant | |
259 | Ceph performance improvements. | |
2394c306 | 260 | |
7367ba5b TL |
261 | You have two more options which are considered advanced and therefore should |
262 | only changed if you know what you are doing. | |
2394c306 | 263 | |
7367ba5b TL |
264 | * *Number of replicas*: Defines how often an object is replicated. |
265 | * *Minimum replicas*: Defines the minimum number of required replicas for I/O to | |
266 | be marked as complete. | |
2394c306 | 267 | |
40e6c806 | 268 | Additionally, you need to choose your first monitor node. This step is required. |
2394c306 | 269 | |
40e6c806 DW |
270 | That's it. You should now see a success page as the last step, with further |
271 | instructions on how to proceed. Your system is now ready to start using Ceph. | |
272 | To get started, you will need to create some additional xref:pve_ceph_monitors[monitors], | |
273 | xref:pve_ceph_osds[OSDs] and at least one xref:pve_ceph_pools[pool]. | |
2394c306 | 274 | |
40e6c806 DW |
275 | The rest of this chapter will guide you through getting the most out of |
276 | your {pve} based Ceph setup. This includes the aforementioned tips and | |
277 | more, such as xref:pveceph_fs[CephFS], which is a helpful addition to your | |
2394c306 | 278 | new Ceph cluster. |
21394e70 | 279 | |
58f95dd7 | 280 | [[pve_ceph_install]] |
513e2f57 TL |
281 | CLI Installation of Ceph Packages |
282 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
283 | ||
284 | Alternatively to the the recommended {pve} Ceph installation wizard available | |
285 | in the web-interface, you can use the following CLI command on each node: | |
21394e70 DM |
286 | |
287 | [source,bash] | |
288 | ---- | |
19920184 | 289 | pveceph install |
21394e70 DM |
290 | ---- |
291 | ||
292 | This sets up an `apt` package repository in | |
293 | `/etc/apt/sources.list.d/ceph.list` and installs the required software. | |
294 | ||
295 | ||
513e2f57 TL |
296 | Initial Ceph configuration via CLI |
297 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
8997dd6e | 298 | |
2394c306 TM |
299 | Use the {pve} Ceph installation wizard (recommended) or run the |
300 | following command on one node: | |
21394e70 DM |
301 | |
302 | [source,bash] | |
303 | ---- | |
304 | pveceph init --network 10.10.10.0/24 | |
305 | ---- | |
306 | ||
2394c306 | 307 | This creates an initial configuration at `/etc/pve/ceph.conf` with a |
40e6c806 DW |
308 | dedicated network for Ceph. This file is automatically distributed to |
309 | all {pve} nodes, using xref:chapter_pmxcfs[pmxcfs]. The command also | |
310 | creates a symbolic link at `/etc/ceph/ceph.conf`, which points to that file. | |
311 | Thus, you can simply run Ceph commands without the need to specify a | |
2394c306 | 312 | configuration file. |
21394e70 DM |
313 | |
314 | ||
d9a27ee1 | 315 | [[pve_ceph_monitors]] |
b3338e29 AA |
316 | Ceph Monitor |
317 | ----------- | |
513e2f57 TL |
318 | |
319 | [thumbnail="screenshot/gui-ceph-monitor.png"] | |
320 | ||
1d54c3b4 | 321 | The Ceph Monitor (MON) |
b46a49ed | 322 | footnote:[Ceph Monitor {cephdocs-url}/start/intro/] |
40e6c806 DW |
323 | maintains a master copy of the cluster map. For high availability, you need at |
324 | least 3 monitors. One monitor will already be installed if you | |
325 | used the installation wizard. You won't need more than 3 monitors, as long | |
326 | as your cluster is small to medium-sized. Only really large clusters will | |
327 | require more than this. | |
1d54c3b4 | 328 | |
c998bdf2 | 329 | [[pveceph_create_mon]] |
b3338e29 AA |
330 | Create Monitors |
331 | ~~~~~~~~~~~~~~~ | |
332 | ||
1d54c3b4 | 333 | On each node where you want to place a monitor (three monitors are recommended), |
40e6c806 | 334 | create one by using the 'Ceph -> Monitor' tab in the GUI or run: |
21394e70 DM |
335 | |
336 | ||
337 | [source,bash] | |
338 | ---- | |
d1fdb121 | 339 | pveceph mon create |
21394e70 DM |
340 | ---- |
341 | ||
c998bdf2 | 342 | [[pveceph_destroy_mon]] |
b3338e29 AA |
343 | Destroy Monitors |
344 | ~~~~~~~~~~~~~~~~ | |
0e38a564 | 345 | |
40e6c806 | 346 | To remove a Ceph Monitor via the GUI, first select a node in the tree view and |
0e38a564 AA |
347 | go to the **Ceph -> Monitor** panel. Select the MON and click the **Destroy** |
348 | button. | |
349 | ||
40e6c806 | 350 | To remove a Ceph Monitor via the CLI, first connect to the node on which the MON |
0e38a564 AA |
351 | is running. Then execute the following command: |
352 | [source,bash] | |
353 | ---- | |
354 | pveceph mon destroy | |
355 | ---- | |
356 | ||
357 | NOTE: At least three Monitors are needed for quorum. | |
358 | ||
359 | ||
1d54c3b4 | 360 | [[pve_ceph_manager]] |
b3338e29 AA |
361 | Ceph Manager |
362 | ------------ | |
40e6c806 | 363 | |
b3338e29 | 364 | The Manager daemon runs alongside the monitors. It provides an interface to |
40e6c806 | 365 | monitor the cluster. Since the release of Ceph luminous, at least one ceph-mgr |
b46a49ed | 366 | footnote:[Ceph Manager {cephdocs-url}/mgr/] daemon is |
b3338e29 AA |
367 | required. |
368 | ||
55d634e6 | 369 | [[pveceph_create_mgr]] |
b3338e29 AA |
370 | Create Manager |
371 | ~~~~~~~~~~~~~~ | |
1d54c3b4 | 372 | |
40e6c806 DW |
373 | Multiple Managers can be installed, but only one Manager is active at any given |
374 | time. | |
1d54c3b4 | 375 | |
1d54c3b4 AA |
376 | [source,bash] |
377 | ---- | |
d1fdb121 | 378 | pveceph mgr create |
1d54c3b4 AA |
379 | ---- |
380 | ||
c1f38fe3 AA |
381 | NOTE: It is recommended to install the Ceph Manager on the monitor nodes. For |
382 | high availability install more then one manager. | |
383 | ||
21394e70 | 384 | |
c998bdf2 | 385 | [[pveceph_destroy_mgr]] |
b3338e29 AA |
386 | Destroy Manager |
387 | ~~~~~~~~~~~~~~~ | |
549350fe | 388 | |
40e6c806 | 389 | To remove a Ceph Manager via the GUI, first select a node in the tree view and |
549350fe AA |
390 | go to the **Ceph -> Monitor** panel. Select the Manager and click the |
391 | **Destroy** button. | |
392 | ||
40e6c806 | 393 | To remove a Ceph Monitor via the CLI, first connect to the node on which the |
549350fe AA |
394 | Manager is running. Then execute the following command: |
395 | [source,bash] | |
396 | ---- | |
397 | pveceph mgr destroy | |
398 | ---- | |
399 | ||
40e6c806 DW |
400 | NOTE: While a manager is not a hard-dependency, it is crucial for a Ceph cluster, |
401 | as it handles important features like PG-autoscaling, device health monitoring, | |
402 | telemetry and more. | |
549350fe | 403 | |
d9a27ee1 | 404 | [[pve_ceph_osds]] |
b3338e29 AA |
405 | Ceph OSDs |
406 | --------- | |
513e2f57 TL |
407 | |
408 | [thumbnail="screenshot/gui-ceph-osd-status.png"] | |
409 | ||
40e6c806 | 410 | Ceph **O**bject **S**torage **D**aemons store objects for Ceph over the |
b3338e29 AA |
411 | network. It is recommended to use one OSD per physical disk. |
412 | ||
081cb761 | 413 | [[pve_ceph_osd_create]] |
b3338e29 AA |
414 | Create OSDs |
415 | ~~~~~~~~~~~ | |
21394e70 | 416 | |
40e6c806 | 417 | You can create an OSD either via the {pve} web-interface or via the CLI using |
e79e0b9d | 418 | `pveceph`. For example: |
21394e70 DM |
419 | |
420 | [source,bash] | |
421 | ---- | |
d1fdb121 | 422 | pveceph osd create /dev/sd[X] |
21394e70 DM |
423 | ---- |
424 | ||
40e6c806 | 425 | TIP: We recommend a Ceph cluster with at least three nodes and at least 12 |
e79e0b9d | 426 | OSDs, evenly distributed among the nodes. |
1d54c3b4 | 427 | |
40e6c806 DW |
428 | If the disk was in use before (for example, for ZFS or as an OSD) you first need |
429 | to zap all traces of that usage. To remove the partition table, boot sector and | |
430 | any other OSD leftover, you can use the following command: | |
a474ca1f AA |
431 | |
432 | [source,bash] | |
433 | ---- | |
9bddef40 | 434 | ceph-volume lvm zap /dev/sd[X] --destroy |
a474ca1f AA |
435 | ---- |
436 | ||
e79e0b9d | 437 | WARNING: The above command will destroy all data on the disk! |
1d54c3b4 | 438 | |
b3338e29 | 439 | .Ceph Bluestore |
21394e70 | 440 | |
1d54c3b4 | 441 | Starting with the Ceph Kraken release, a new Ceph OSD storage type was |
40e6c806 | 442 | introduced called Bluestore |
2798d126 | 443 | footnote:[Ceph Bluestore https://ceph.com/community/new-luminous-bluestore/]. |
9bddef40 | 444 | This is the default when creating OSDs since Ceph Luminous. |
21394e70 DM |
445 | |
446 | [source,bash] | |
447 | ---- | |
d1fdb121 | 448 | pveceph osd create /dev/sd[X] |
1d54c3b4 AA |
449 | ---- |
450 | ||
1e834cb2 | 451 | .Block.db and block.wal |
1d54c3b4 AA |
452 | |
453 | If you want to use a separate DB/WAL device for your OSDs, you can specify it | |
b3338e29 AA |
454 | through the '-db_dev' and '-wal_dev' options. The WAL is placed with the DB, if |
455 | not specified separately. | |
1d54c3b4 AA |
456 | |
457 | [source,bash] | |
458 | ---- | |
d1fdb121 | 459 | pveceph osd create /dev/sd[X] -db_dev /dev/sd[Y] -wal_dev /dev/sd[Z] |
1d54c3b4 AA |
460 | ---- |
461 | ||
40e6c806 DW |
462 | You can directly choose the size of those with the '-db_size' and '-wal_size' |
463 | parameters respectively. If they are not given, the following values (in order) | |
9bddef40 DC |
464 | will be used: |
465 | ||
40e6c806 | 466 | * bluestore_block_{db,wal}_size from Ceph configuration... |
352c803f TL |
467 | ** ... database, section 'osd' |
468 | ** ... database, section 'global' | |
469 | ** ... file, section 'osd' | |
470 | ** ... file, section 'global' | |
9bddef40 DC |
471 | * 10% (DB)/1% (WAL) of OSD size |
472 | ||
40e6c806 | 473 | NOTE: The DB stores BlueStore’s internal metadata, and the WAL is BlueStore’s |
ee4a0e96 | 474 | internal journal or write-ahead log. It is recommended to use a fast SSD or |
1d54c3b4 AA |
475 | NVRAM for better performance. |
476 | ||
b3338e29 | 477 | .Ceph Filestore |
9bddef40 | 478 | |
40e6c806 | 479 | Before Ceph Luminous, Filestore was used as the default storage type for Ceph OSDs. |
9bddef40 | 480 | Starting with Ceph Nautilus, {pve} does not support creating such OSDs with |
352c803f TL |
481 | 'pveceph' anymore. If you still want to create filestore OSDs, use |
482 | 'ceph-volume' directly. | |
1d54c3b4 AA |
483 | |
484 | [source,bash] | |
485 | ---- | |
9bddef40 | 486 | ceph-volume lvm create --filestore --data /dev/sd[X] --journal /dev/sd[Y] |
21394e70 DM |
487 | ---- |
488 | ||
081cb761 | 489 | [[pve_ceph_osd_destroy]] |
b3338e29 AA |
490 | Destroy OSDs |
491 | ~~~~~~~~~~~~ | |
be2d137e | 492 | |
40e6c806 DW |
493 | To remove an OSD via the GUI, first select a {PVE} node in the tree view and go |
494 | to the **Ceph -> OSD** panel. Then select the OSD to destroy and click the **OUT** | |
495 | button. Once the OSD status has changed from `in` to `out`, click the **STOP** | |
496 | button. Finally, after the status has changed from `up` to `down`, select | |
497 | **Destroy** from the `More` drop-down menu. | |
be2d137e AA |
498 | |
499 | To remove an OSD via the CLI run the following commands. | |
40e6c806 | 500 | |
be2d137e AA |
501 | [source,bash] |
502 | ---- | |
503 | ceph osd out <ID> | |
504 | systemctl stop ceph-osd@<ID>.service | |
505 | ---- | |
40e6c806 | 506 | |
be2d137e AA |
507 | NOTE: The first command instructs Ceph not to include the OSD in the data |
508 | distribution. The second command stops the OSD service. Until this time, no | |
509 | data is lost. | |
510 | ||
511 | The following command destroys the OSD. Specify the '-cleanup' option to | |
512 | additionally destroy the partition table. | |
40e6c806 | 513 | |
be2d137e AA |
514 | [source,bash] |
515 | ---- | |
516 | pveceph osd destroy <ID> | |
517 | ---- | |
40e6c806 DW |
518 | |
519 | WARNING: The above command will destroy all data on the disk! | |
be2d137e AA |
520 | |
521 | ||
07fef357 | 522 | [[pve_ceph_pools]] |
b3338e29 AA |
523 | Ceph Pools |
524 | ---------- | |
94d7a98c TL |
525 | |
526 | [thumbnail="screenshot/gui-ceph-pools.png"] | |
527 | ||
40e6c806 DW |
528 | A pool is a logical group for storing objects. It holds a collection of objects, |
529 | known as **P**lacement **G**roups (`PG`, `pg_num`). | |
1d54c3b4 | 530 | |
b3338e29 | 531 | |
6004d86b | 532 | Create and Edit Pools |
5b9f923f | 533 | ~~~~~~~~~~~~~~~~~~~~~ |
b3338e29 | 534 | |
513e2f57 TL |
535 | You can create and edit pools from the command line or the web-interface of any |
536 | {pve} host under **Ceph -> Pools**. | |
d56606c7 | 537 | |
90682f35 | 538 | When no options are given, we set a default of **128 PGs**, a **size of 3 |
d56606c7 TL |
539 | replicas** and a **min_size of 2 replicas**, to ensure no data loss occurs if |
540 | any OSD fails. | |
1d54c3b4 | 541 | |
ef3efe51 | 542 | WARNING: **Do not set a min_size of 1**. A replicated pool with min_size of 1 |
40e6c806 | 543 | allows I/O on an object when it has only 1 replica, which could lead to data |
ef3efe51 AA |
544 | loss, incomplete PGs or unfound objects. |
545 | ||
513e2f57 TL |
546 | It is advised that you either enable the PG-Autoscaler or calculate the PG |
547 | number based on your setup. You can find the formula and the PG calculator | |
f8bfcb41 | 548 | footnote:[PG calculator https://web.archive.org/web/20210301111112/http://ceph.com/pgcalc/] online. From Ceph Nautilus |
513e2f57 TL |
549 | onward, you can change the number of PGs |
550 | footnoteref:[placement_groups,Placement Groups | |
c446b6bb | 551 | {cephdocs-url}/rados/operations/placement-groups/] after the setup. |
1d54c3b4 | 552 | |
513e2f57 | 553 | The PG autoscaler footnoteref:[autoscaler,Automated Scaling |
c446b6bb | 554 | {cephdocs-url}/rados/operations/placement-groups/#automated-scaling] can |
513e2f57 TL |
555 | automatically scale the PG count for a pool in the background. Setting the |
556 | `Target Size` or `Target Ratio` advanced parameters helps the PG-Autoscaler to | |
557 | make better decisions. | |
1d54c3b4 | 558 | |
d56606c7 | 559 | .Example for creating a pool over the CLI |
1d54c3b4 AA |
560 | [source,bash] |
561 | ---- | |
41791cf8 | 562 | pveceph pool create <pool-name> --add_storages |
1d54c3b4 AA |
563 | ---- |
564 | ||
40e6c806 DW |
565 | TIP: If you would also like to automatically define a storage for your |
566 | pool, keep the `Add as Storage' checkbox checked in the web-interface, or use the | |
d56606c7 | 567 | command line option '--add_storages' at pool creation. |
21394e70 | 568 | |
513e2f57 TL |
569 | Pool Options |
570 | ^^^^^^^^^^^^ | |
571 | ||
94d7a98c TL |
572 | [thumbnail="screenshot/gui-ceph-pool-create.png"] |
573 | ||
513e2f57 TL |
574 | The following options are available on pool creation, and partially also when |
575 | editing a pool. | |
576 | ||
c446b6bb DW |
577 | Name:: The name of the pool. This must be unique and can't be changed afterwards. |
578 | Size:: The number of replicas per object. Ceph always tries to have this many | |
579 | copies of an object. Default: `3`. | |
580 | PG Autoscale Mode:: The automatic PG scaling mode footnoteref:[autoscaler] of | |
581 | the pool. If set to `warn`, it produces a warning message when a pool | |
582 | has a non-optimal PG count. Default: `warn`. | |
583 | Add as Storage:: Configure a VM or container storage using the new pool. | |
5b9f923f | 584 | Default: `true` (only visible on creation). |
c446b6bb DW |
585 | |
586 | .Advanced Options | |
587 | Min. Size:: The minimum number of replicas per object. Ceph will reject I/O on | |
588 | the pool if a PG has less than this many replicas. Default: `2`. | |
589 | Crush Rule:: The rule to use for mapping object placement in the cluster. These | |
590 | rules define how data is placed within the cluster. See | |
591 | xref:pve_ceph_device_classes[Ceph CRUSH & device classes] for information on | |
592 | device-based rules. | |
593 | # of PGs:: The number of placement groups footnoteref:[placement_groups] that | |
594 | the pool should have at the beginning. Default: `128`. | |
513e2f57 | 595 | Target Ratio:: The ratio of data that is expected in the pool. The PG |
c446b6bb DW |
596 | autoscaler uses the ratio relative to other ratio sets. It takes precedence |
597 | over the `target size` if both are set. | |
a0d289ff DC |
598 | Target Size:: The estimated amount of data expected in the pool. The PG |
599 | autoscaler uses this size to estimate the optimal PG count. | |
c446b6bb DW |
600 | Min. # of PGs:: The minimum number of placement groups. This setting is used to |
601 | fine-tune the lower bound of the PG count for that pool. The PG autoscaler | |
602 | will not merge PGs below this threshold. | |
603 | ||
1d54c3b4 AA |
604 | Further information on Ceph pool handling can be found in the Ceph pool |
605 | operation footnote:[Ceph pool operation | |
b46a49ed | 606 | {cephdocs-url}/rados/operations/pools/] |
1d54c3b4 | 607 | manual. |
21394e70 | 608 | |
166c91fe | 609 | |
cbb265a3 | 610 | [[pve_ceph_ec_pools]] |
41791cf8 TL |
611 | Erasure Coded Pools |
612 | ~~~~~~~~~~~~~~~~~~~ | |
cbb265a3 | 613 | |
41791cf8 TL |
614 | Erasure coding (EC) is a form of `forward error correction' codes that allows |
615 | to recover from a certain amount of data loss. Erasure coded pools can offer | |
616 | more usable space compared to replicated pools, but they do that for the price | |
617 | of performance. | |
618 | ||
42135e58 | 619 | For comparison: in classic, replicated pools, multiple replicas of the data |
41791cf8 TL |
620 | are stored (`size`) while in erasure coded pool, data is split into `k` data |
621 | chunks with additional `m` coding (checking) chunks. Those coding chunks can be | |
622 | used to recreate data should data chunks be missing. | |
623 | ||
624 | The number of coding chunks, `m`, defines how many OSDs can be lost without | |
625 | losing any data. The total amount of objects stored is `k + m`. | |
626 | ||
627 | Creating EC Pools | |
628 | ^^^^^^^^^^^^^^^^^ | |
629 | ||
42135e58 AL |
630 | Erasure coded (EC) pools can be created with the `pveceph` CLI tooling. |
631 | Planning an EC pool needs to account for the fact, that they work differently | |
632 | than replicated pools. | |
cbb265a3 | 633 | |
e9d331c5 TL |
634 | The default `min_size` of an EC pool depends on the `m` parameter. If `m = 1`, |
635 | the `min_size` of the EC pool will be `k`. The `min_size` will be `k + 1` if | |
636 | `m > 1`. The Ceph documentation recommends a conservative `min_size` of `k + 2` | |
cbb265a3 AL |
637 | footnote:[Ceph Erasure Coded Pool Recovery |
638 | {cephdocs-url}/rados/operations/erasure-code/#erasure-coded-pool-recovery]. | |
639 | ||
e9d331c5 | 640 | If there are less than `min_size` OSDs available, any IO to the pool will be |
cbb265a3 AL |
641 | blocked until there are enough OSDs available again. |
642 | ||
e9d331c5 | 643 | NOTE: When planning an erasure coded pool, keep an eye on the `min_size` as it |
cbb265a3 AL |
644 | defines how many OSDs need to be available. Otherwise, IO will be blocked. |
645 | ||
e9d331c5 TL |
646 | For example, an EC pool with `k = 2` and `m = 1` will have `size = 3`, |
647 | `min_size = 2` and will stay operational if one OSD fails. If the pool is | |
648 | configured with `k = 2`, `m = 2`, it will have a `size = 4` and `min_size = 3` | |
cbb265a3 AL |
649 | and stay operational if one OSD is lost. |
650 | ||
651 | To create a new EC pool, run the following command: | |
652 | ||
653 | [source,bash] | |
654 | ---- | |
81de7382 | 655 | pveceph pool create <pool-name> --erasure-coding k=2,m=1 |
cbb265a3 AL |
656 | ---- |
657 | ||
e9d331c5 | 658 | Optional parameters are `failure-domain` and `device-class`. If you |
cbb265a3 AL |
659 | need to change any EC profile settings used by the pool, you will have to |
660 | create a new pool with a new profile. | |
661 | ||
662 | This will create a new EC pool plus the needed replicated pool to store the RBD | |
e9d331c5 TL |
663 | omap and other metadata. In the end, there will be a `<pool name>-data` and |
664 | `<pool name>-metada` pool. The default behavior is to create a matching storage | |
cbb265a3 | 665 | configuration as well. If that behavior is not wanted, you can disable it by |
e9d331c5 TL |
666 | providing the `--add_storages 0` parameter. When configuring the storage |
667 | configuration manually, keep in mind that the `data-pool` parameter needs to be | |
cbb265a3 AL |
668 | set. Only then will the EC pool be used to store the data objects. For example: |
669 | ||
e9d331c5 | 670 | NOTE: The optional parameters `--size`, `--min_size` and `--crush_rule` will be |
12730071 | 671 | used for the replicated metadata pool, but not for the erasure coded data pool. |
e9d331c5 TL |
672 | If you need to change the `min_size` on the data pool, you can do it later. |
673 | The `size` and `crush_rule` parameters cannot be changed on erasure coded | |
12730071 AL |
674 | pools. |
675 | ||
cbb265a3 AL |
676 | If there is a need to further customize the EC profile, you can do so by |
677 | creating it with the Ceph tools directly footnote:[Ceph Erasure Code Profile | |
678 | {cephdocs-url}/rados/operations/erasure-code/#erasure-code-profiles], and | |
e9d331c5 | 679 | specify the profile to use with the `profile` parameter. |
cbb265a3 AL |
680 | |
681 | For example: | |
682 | [source,bash] | |
683 | ---- | |
81de7382 | 684 | pveceph pool create <pool-name> --erasure-coding profile=<profile-name> |
41791cf8 TL |
685 | ---- |
686 | ||
687 | Adding EC Pools as Storage | |
688 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
689 | ||
42135e58 AL |
690 | You can add an already existing EC pool as storage to {pve}. It works the same |
691 | way as adding an `RBD` pool but requires the extra `data-pool` option. | |
41791cf8 TL |
692 | |
693 | [source,bash] | |
694 | ---- | |
695 | pvesm add rbd <storage-name> --pool <replicated-pool> --data-pool <ec-pool> | |
cbb265a3 AL |
696 | ---- |
697 | ||
41791cf8 | 698 | TIP: Do not forget to add the `keyring` and `monhost` option for any external |
f226da0e | 699 | Ceph clusters, not managed by the local {pve} cluster. |
cbb265a3 | 700 | |
b3338e29 AA |
701 | Destroy Pools |
702 | ~~~~~~~~~~~~~ | |
166c91fe | 703 | |
40e6c806 | 704 | To destroy a pool via the GUI, select a node in the tree view and go to the |
166c91fe | 705 | **Ceph -> Pools** panel. Select the pool to destroy and click the **Destroy** |
40e6c806 | 706 | button. To confirm the destruction of the pool, you need to enter the pool name. |
166c91fe AA |
707 | |
708 | Run the following command to destroy a pool. Specify the '-remove_storages' to | |
709 | also remove the associated storage. | |
40e6c806 | 710 | |
166c91fe AA |
711 | [source,bash] |
712 | ---- | |
713 | pveceph pool destroy <name> | |
714 | ---- | |
715 | ||
40e6c806 DW |
716 | NOTE: Pool deletion runs in the background and can take some time. |
717 | You will notice the data usage in the cluster decreasing throughout this | |
718 | process. | |
166c91fe | 719 | |
47d62c84 DW |
720 | |
721 | PG Autoscaler | |
722 | ~~~~~~~~~~~~~ | |
723 | ||
724 | The PG autoscaler allows the cluster to consider the amount of (expected) data | |
725 | stored in each pool and to choose the appropriate pg_num values automatically. | |
513e2f57 | 726 | It is available since Ceph Nautilus. |
47d62c84 DW |
727 | |
728 | You may need to activate the PG autoscaler module before adjustments can take | |
729 | effect. | |
40e6c806 | 730 | |
47d62c84 DW |
731 | [source,bash] |
732 | ---- | |
733 | ceph mgr module enable pg_autoscaler | |
734 | ---- | |
735 | ||
736 | The autoscaler is configured on a per pool basis and has the following modes: | |
737 | ||
738 | [horizontal] | |
739 | warn:: A health warning is issued if the suggested `pg_num` value differs too | |
740 | much from the current value. | |
741 | on:: The `pg_num` is adjusted automatically with no need for any manual | |
742 | interaction. | |
743 | off:: No automatic `pg_num` adjustments are made, and no warning will be issued | |
40e6c806 | 744 | if the PG count is not optimal. |
47d62c84 | 745 | |
40e6c806 | 746 | The scaling factor can be adjusted to facilitate future data storage with the |
47d62c84 DW |
747 | `target_size`, `target_size_ratio` and the `pg_num_min` options. |
748 | ||
749 | WARNING: By default, the autoscaler considers tuning the PG count of a pool if | |
750 | it is off by a factor of 3. This will lead to a considerable shift in data | |
751 | placement and might introduce a high load on the cluster. | |
752 | ||
753 | You can find a more in-depth introduction to the PG autoscaler on Ceph's Blog - | |
754 | https://ceph.io/rados/new-in-nautilus-pg-merging-and-autotuning/[New in | |
755 | Nautilus: PG merging and autotuning]. | |
756 | ||
757 | ||
76f6eca4 | 758 | [[pve_ceph_device_classes]] |
9fad507d AA |
759 | Ceph CRUSH & device classes |
760 | --------------------------- | |
513e2f57 TL |
761 | |
762 | [thumbnail="screenshot/gui-ceph-config.png"] | |
763 | ||
40e6c806 DW |
764 | The footnote:[CRUSH |
765 | https://ceph.com/wp-content/uploads/2016/08/weil-crush-sc06.pdf] (**C**ontrolled | |
766 | **R**eplication **U**nder **S**calable **H**ashing) algorithm is at the | |
767 | foundation of Ceph. | |
9fad507d | 768 | |
40e6c806 DW |
769 | CRUSH calculates where to store and retrieve data from. This has the |
770 | advantage that no central indexing service is needed. CRUSH works using a map of | |
9fad507d AA |
771 | OSDs, buckets (device locations) and rulesets (data replication) for pools. |
772 | ||
773 | NOTE: Further information can be found in the Ceph documentation, under the | |
b46a49ed | 774 | section CRUSH map footnote:[CRUSH map {cephdocs-url}/rados/operations/crush-map/]. |
9fad507d AA |
775 | |
776 | This map can be altered to reflect different replication hierarchies. The object | |
3a433e9b | 777 | replicas can be separated (e.g., failure domains), while maintaining the desired |
9fad507d AA |
778 | distribution. |
779 | ||
40e6c806 DW |
780 | A common configuration is to use different classes of disks for different Ceph |
781 | pools. For this reason, Ceph introduced device classes with luminous, to | |
9fad507d AA |
782 | accommodate the need for easy ruleset generation. |
783 | ||
784 | The device classes can be seen in the 'ceph osd tree' output. These classes | |
785 | represent their own root bucket, which can be seen with the below command. | |
786 | ||
787 | [source, bash] | |
788 | ---- | |
789 | ceph osd crush tree --show-shadow | |
790 | ---- | |
791 | ||
792 | Example output form the above command: | |
793 | ||
794 | [source, bash] | |
795 | ---- | |
796 | ID CLASS WEIGHT TYPE NAME | |
797 | -16 nvme 2.18307 root default~nvme | |
798 | -13 nvme 0.72769 host sumi1~nvme | |
799 | 12 nvme 0.72769 osd.12 | |
800 | -14 nvme 0.72769 host sumi2~nvme | |
801 | 13 nvme 0.72769 osd.13 | |
802 | -15 nvme 0.72769 host sumi3~nvme | |
803 | 14 nvme 0.72769 osd.14 | |
804 | -1 7.70544 root default | |
805 | -3 2.56848 host sumi1 | |
806 | 12 nvme 0.72769 osd.12 | |
807 | -5 2.56848 host sumi2 | |
808 | 13 nvme 0.72769 osd.13 | |
809 | -7 2.56848 host sumi3 | |
810 | 14 nvme 0.72769 osd.14 | |
811 | ---- | |
812 | ||
40e6c806 DW |
813 | To instruct a pool to only distribute objects on a specific device class, you |
814 | first need to create a ruleset for the device class: | |
9fad507d AA |
815 | |
816 | [source, bash] | |
817 | ---- | |
818 | ceph osd crush rule create-replicated <rule-name> <root> <failure-domain> <class> | |
819 | ---- | |
820 | ||
821 | [frame="none",grid="none", align="left", cols="30%,70%"] | |
822 | |=== | |
823 | |<rule-name>|name of the rule, to connect with a pool (seen in GUI & CLI) | |
f226da0e | 824 | |<root>|which crush root it should belong to (default Ceph root "default") |
9fad507d | 825 | |<failure-domain>|at which failure-domain the objects should be distributed (usually host) |
3a433e9b | 826 | |<class>|what type of OSD backing store to use (e.g., nvme, ssd, hdd) |
9fad507d AA |
827 | |=== |
828 | ||
829 | Once the rule is in the CRUSH map, you can tell a pool to use the ruleset. | |
830 | ||
831 | [source, bash] | |
832 | ---- | |
833 | ceph osd pool set <pool-name> crush_rule <rule-name> | |
834 | ---- | |
835 | ||
40e6c806 DW |
836 | TIP: If the pool already contains objects, these must be moved accordingly. |
837 | Depending on your setup, this may introduce a big performance impact on your | |
838 | cluster. As an alternative, you can create a new pool and move disks separately. | |
9fad507d AA |
839 | |
840 | ||
21394e70 DM |
841 | Ceph Client |
842 | ----------- | |
843 | ||
1ff5e4e8 | 844 | [thumbnail="screenshot/gui-ceph-log.png"] |
8997dd6e | 845 | |
40e6c806 DW |
846 | Following the setup from the previous sections, you can configure {pve} to use |
847 | such pools to store VM and Container images. Simply use the GUI to add a new | |
513e2f57 TL |
848 | `RBD` storage (see section |
849 | xref:ceph_rados_block_devices[Ceph RADOS Block Devices (RBD)]). | |
21394e70 | 850 | |
620d6725 | 851 | You also need to copy the keyring to a predefined location for an external Ceph |
1d54c3b4 AA |
852 | cluster. If Ceph is installed on the Proxmox nodes itself, then this will be |
853 | done automatically. | |
21394e70 | 854 | |
40e6c806 DW |
855 | NOTE: The filename needs to be `<storage_id> + `.keyring`, where `<storage_id>` is |
856 | the expression after 'rbd:' in `/etc/pve/storage.cfg`. In the following example, | |
857 | `my-ceph-storage` is the `<storage_id>`: | |
21394e70 DM |
858 | |
859 | [source,bash] | |
860 | ---- | |
861 | mkdir /etc/pve/priv/ceph | |
862 | cp /etc/ceph/ceph.client.admin.keyring /etc/pve/priv/ceph/my-ceph-storage.keyring | |
863 | ---- | |
0840a663 | 864 | |
58f95dd7 TL |
865 | [[pveceph_fs]] |
866 | CephFS | |
867 | ------ | |
868 | ||
40e6c806 DW |
869 | Ceph also provides a filesystem, which runs on top of the same object storage as |
870 | RADOS block devices do. A **M**eta**d**ata **S**erver (`MDS`) is used to map the | |
871 | RADOS backed objects to files and directories, allowing Ceph to provide a | |
872 | POSIX-compliant, replicated filesystem. This allows you to easily configure a | |
873 | clustered, highly available, shared filesystem. Ceph's Metadata Servers | |
874 | guarantee that files are evenly distributed over the entire Ceph cluster. As a | |
875 | result, even cases of high load will not overwhelm a single host, which can be | |
876 | an issue with traditional shared filesystem approaches, for example `NFS`. | |
58f95dd7 | 877 | |
1e834cb2 TL |
878 | [thumbnail="screenshot/gui-node-ceph-cephfs-panel.png"] |
879 | ||
40e6c806 DW |
880 | {pve} supports both creating a hyper-converged CephFS and using an existing |
881 | xref:storage_cephfs[CephFS as storage] to save backups, ISO files, and container | |
882 | templates. | |
58f95dd7 TL |
883 | |
884 | ||
885 | [[pveceph_fs_mds]] | |
886 | Metadata Server (MDS) | |
887 | ~~~~~~~~~~~~~~~~~~~~~ | |
888 | ||
40e6c806 DW |
889 | CephFS needs at least one Metadata Server to be configured and running, in order |
890 | to function. You can create an MDS through the {pve} web GUI's `Node | |
891 | -> CephFS` panel or from the command line with: | |
58f95dd7 TL |
892 | |
893 | ---- | |
894 | pveceph mds create | |
895 | ---- | |
896 | ||
40e6c806 DW |
897 | Multiple metadata servers can be created in a cluster, but with the default |
898 | settings, only one can be active at a time. If an MDS or its node becomes | |
58f95dd7 | 899 | unresponsive (or crashes), another `standby` MDS will get promoted to `active`. |
40e6c806 DW |
900 | You can speed up the handover between the active and standby MDS by using |
901 | the 'hotstandby' parameter option on creation, or if you have already created it | |
58f95dd7 TL |
902 | you may set/add: |
903 | ||
904 | ---- | |
905 | mds standby replay = true | |
906 | ---- | |
907 | ||
40e6c806 DW |
908 | in the respective MDS section of `/etc/pve/ceph.conf`. With this enabled, the |
909 | specified MDS will remain in a `warm` state, polling the active one, so that it | |
910 | can take over faster in case of any issues. | |
911 | ||
912 | NOTE: This active polling will have an additional performance impact on your | |
913 | system and the active `MDS`. | |
58f95dd7 | 914 | |
1e834cb2 | 915 | .Multiple Active MDS |
58f95dd7 | 916 | |
40e6c806 DW |
917 | Since Luminous (12.2.x) you can have multiple active metadata servers |
918 | running at once, but this is normally only useful if you have a high amount of | |
919 | clients running in parallel. Otherwise the `MDS` is rarely the bottleneck in a | |
920 | system. If you want to set this up, please refer to the Ceph documentation. | |
921 | footnote:[Configuring multiple active MDS daemons | |
922 | {cephdocs-url}/cephfs/multimds/] | |
58f95dd7 TL |
923 | |
924 | [[pveceph_fs_create]] | |
8a38333f AA |
925 | Create CephFS |
926 | ~~~~~~~~~~~~~ | |
58f95dd7 | 927 | |
40e6c806 DW |
928 | With {pve}'s integration of CephFS, you can easily create a CephFS using the |
929 | web interface, CLI or an external API interface. Some prerequisites are required | |
58f95dd7 TL |
930 | for this to work: |
931 | ||
932 | .Prerequisites for a successful CephFS setup: | |
40e6c806 DW |
933 | - xref:pve_ceph_install[Install Ceph packages] - if this was already done some |
934 | time ago, you may want to rerun it on an up-to-date system to | |
935 | ensure that all CephFS related packages get installed. | |
58f95dd7 TL |
936 | - xref:pve_ceph_monitors[Setup Monitors] |
937 | - xref:pve_ceph_monitors[Setup your OSDs] | |
938 | - xref:pveceph_fs_mds[Setup at least one MDS] | |
939 | ||
40e6c806 | 940 | After this is complete, you can simply create a CephFS through |
58f95dd7 | 941 | either the Web GUI's `Node -> CephFS` panel or the command line tool `pveceph`, |
40e6c806 | 942 | for example: |
58f95dd7 TL |
943 | |
944 | ---- | |
945 | pveceph fs create --pg_num 128 --add-storage | |
946 | ---- | |
947 | ||
40e6c806 DW |
948 | This creates a CephFS named 'cephfs', using a pool for its data named |
949 | 'cephfs_data' with '128' placement groups and a pool for its metadata named | |
950 | 'cephfs_metadata' with one quarter of the data pool's placement groups (`32`). | |
58f95dd7 | 951 | Check the xref:pve_ceph_pools[{pve} managed Ceph pool chapter] or visit the |
40e6c806 | 952 | Ceph documentation for more information regarding an appropriate placement group |
c446b6bb | 953 | number (`pg_num`) for your setup footnoteref:[placement_groups]. |
40e6c806 | 954 | Additionally, the '--add-storage' parameter will add the CephFS to the {pve} |
c446b6bb | 955 | storage configuration after it has been created successfully. |
58f95dd7 TL |
956 | |
957 | Destroy CephFS | |
958 | ~~~~~~~~~~~~~~ | |
959 | ||
40e6c806 | 960 | WARNING: Destroying a CephFS will render all of its data unusable. This cannot be |
58f95dd7 TL |
961 | undone! |
962 | ||
54f20853 TL |
963 | To completely and gracefully remove a CephFS, the following steps are |
964 | necessary: | |
58f95dd7 | 965 | |
b631c35e DC |
966 | * Disconnect every non-{PVE} client (e.g. unmount the CephFS in guests). |
967 | * Disable all related CephFS {PVE} storage entries (to prevent it from being | |
968 | automatically mounted). | |
969 | * Remove all used resources from guests (e.g. ISOs) that are on the CephFS you | |
970 | want to destroy. | |
971 | * Unmount the CephFS storages on all cluster nodes manually with | |
972 | + | |
58f95dd7 | 973 | ---- |
b631c35e | 974 | umount /mnt/pve/<STORAGE-NAME> |
58f95dd7 | 975 | ---- |
b631c35e DC |
976 | + |
977 | Where `<STORAGE-NAME>` is the name of the CephFS storage in your {PVE}. | |
58f95dd7 | 978 | |
b631c35e | 979 | * Now make sure that no metadata server (`MDS`) is running for that CephFS, |
54f20853 TL |
980 | either by stopping or destroying them. This can be done through the web |
981 | interface or via the command line interface, for the latter you would issue | |
982 | the following command: | |
b631c35e DC |
983 | + |
984 | ---- | |
985 | pveceph stop --service mds.NAME | |
58f95dd7 | 986 | ---- |
b631c35e DC |
987 | + |
988 | to stop them, or | |
989 | + | |
990 | ---- | |
991 | pveceph mds destroy NAME | |
58f95dd7 | 992 | ---- |
b631c35e DC |
993 | + |
994 | to destroy them. | |
995 | + | |
996 | Note that standby servers will automatically be promoted to active when an | |
997 | active `MDS` is stopped or removed, so it is best to first stop all standby | |
998 | servers. | |
58f95dd7 | 999 | |
b631c35e DC |
1000 | * Now you can destroy the CephFS with |
1001 | + | |
58f95dd7 | 1002 | ---- |
b631c35e | 1003 | pveceph fs destroy NAME --remove-storages --remove-pools |
58f95dd7 | 1004 | ---- |
b631c35e | 1005 | + |
f226da0e | 1006 | This will automatically destroy the underlying Ceph pools as well as remove |
b631c35e | 1007 | the storages from pve config. |
0840a663 | 1008 | |
b631c35e DC |
1009 | After these steps, the CephFS should be completely removed and if you have |
1010 | other CephFS instances, the stopped metadata servers can be started again | |
1011 | to act as standbys. | |
6ff32926 | 1012 | |
081cb761 AA |
1013 | Ceph maintenance |
1014 | ---------------- | |
af6f59f4 | 1015 | |
081cb761 AA |
1016 | Replace OSDs |
1017 | ~~~~~~~~~~~~ | |
af6f59f4 | 1018 | |
40e6c806 DW |
1019 | One of the most common maintenance tasks in Ceph is to replace the disk of an |
1020 | OSD. If a disk is already in a failed state, then you can go ahead and run | |
1021 | through the steps in xref:pve_ceph_osd_destroy[Destroy OSDs]. Ceph will recreate | |
1022 | those copies on the remaining OSDs if possible. This rebalancing will start as | |
1023 | soon as an OSD failure is detected or an OSD was actively stopped. | |
af6f59f4 TL |
1024 | |
1025 | NOTE: With the default size/min_size (3/2) of a pool, recovery only starts when | |
1026 | `size + 1` nodes are available. The reason for this is that the Ceph object | |
1027 | balancer xref:pve_ceph_device_classes[CRUSH] defaults to a full node as | |
1028 | `failure domain'. | |
081cb761 | 1029 | |
40e6c806 | 1030 | To replace a functioning disk from the GUI, go through the steps in |
081cb761 AA |
1031 | xref:pve_ceph_osd_destroy[Destroy OSDs]. The only addition is to wait until |
1032 | the cluster shows 'HEALTH_OK' before stopping the OSD to destroy it. | |
1033 | ||
40e6c806 DW |
1034 | On the command line, use the following commands: |
1035 | ||
081cb761 AA |
1036 | ---- |
1037 | ceph osd out osd.<id> | |
1038 | ---- | |
1039 | ||
1040 | You can check with the command below if the OSD can be safely removed. | |
40e6c806 | 1041 | |
081cb761 AA |
1042 | ---- |
1043 | ceph osd safe-to-destroy osd.<id> | |
1044 | ---- | |
1045 | ||
40e6c806 DW |
1046 | Once the above check tells you that it is safe to remove the OSD, you can |
1047 | continue with the following commands: | |
1048 | ||
081cb761 AA |
1049 | ---- |
1050 | systemctl stop ceph-osd@<id>.service | |
1051 | pveceph osd destroy <id> | |
1052 | ---- | |
1053 | ||
1054 | Replace the old disk with the new one and use the same procedure as described | |
1055 | in xref:pve_ceph_osd_create[Create OSDs]. | |
1056 | ||
835f322d TL |
1057 | Trim/Discard |
1058 | ~~~~~~~~~~~~ | |
40e6c806 DW |
1059 | |
1060 | It is good practice to run 'fstrim' (discard) regularly on VMs and containers. | |
081cb761 | 1061 | This releases data blocks that the filesystem isn’t using anymore. It reduces |
c78cd2b6 AA |
1062 | data usage and resource load. Most modern operating systems issue such discard |
1063 | commands to their disks regularly. You only need to ensure that the Virtual | |
1064 | Machines enable the xref:qm_hard_disk_discard[disk discard option]. | |
081cb761 | 1065 | |
c998bdf2 | 1066 | [[pveceph_scrub]] |
081cb761 AA |
1067 | Scrub & Deep Scrub |
1068 | ~~~~~~~~~~~~~~~~~~ | |
40e6c806 | 1069 | |
081cb761 AA |
1070 | Ceph ensures data integrity by 'scrubbing' placement groups. Ceph checks every |
1071 | object in a PG for its health. There are two forms of Scrubbing, daily | |
b16f8c5f TL |
1072 | cheap metadata checks and weekly deep data checks. The weekly deep scrub reads |
1073 | the objects and uses checksums to ensure data integrity. If a running scrub | |
1074 | interferes with business (performance) needs, you can adjust the time when | |
b46a49ed | 1075 | scrubs footnote:[Ceph scrubbing {cephdocs-url}/rados/configuration/osd-config-ref/#scrubbing] |
081cb761 AA |
1076 | are executed. |
1077 | ||
1078 | ||
40e6c806 | 1079 | Ceph Monitoring and Troubleshooting |
10df14fb | 1080 | ----------------------------------- |
40e6c806 DW |
1081 | |
1082 | It is important to continuously monitor the health of a Ceph deployment from the | |
1083 | beginning, either by using the Ceph tools or by accessing | |
10df14fb | 1084 | the status through the {pve} link:api-viewer/index.html[API]. |
6ff32926 | 1085 | |
40e6c806 | 1086 | The following Ceph commands can be used to see if the cluster is healthy |
10df14fb | 1087 | ('HEALTH_OK'), if there are warnings ('HEALTH_WARN'), or even errors |
40e6c806 | 1088 | ('HEALTH_ERR'). If the cluster is in an unhealthy state, the status commands |
620d6725 | 1089 | below will also give you an overview of the current events and actions to take. |
6ff32926 AA |
1090 | |
1091 | ---- | |
10df14fb TL |
1092 | # single time output |
1093 | pve# ceph -s | |
1094 | # continuously output status changes (press CTRL+C to stop) | |
1095 | pve# ceph -w | |
6ff32926 AA |
1096 | ---- |
1097 | ||
40e6c806 DW |
1098 | To get a more detailed view, every Ceph service has a log file under |
1099 | `/var/log/ceph/`. If more detail is required, the log level can be | |
b46a49ed | 1100 | adjusted footnote:[Ceph log and debugging {cephdocs-url}/rados/troubleshooting/log-and-debug/]. |
6ff32926 AA |
1101 | |
1102 | You can find more information about troubleshooting | |
b46a49ed | 1103 | footnote:[Ceph troubleshooting {cephdocs-url}/rados/troubleshooting/] |
620d6725 | 1104 | a Ceph cluster on the official website. |
6ff32926 AA |
1105 | |
1106 | ||
0840a663 DM |
1107 | ifdef::manvolnum[] |
1108 | include::pve-copyright.adoc[] | |
1109 | endif::manvolnum[] |