]> git.proxmox.com Git - ceph.git/blob - ceph/doc/mgr/orchestrator.rst
import 15.2.4
[ceph.git] / ceph / doc / mgr / orchestrator.rst
1
2 .. _orchestrator-cli-module:
3
4 ================
5 Orchestrator CLI
6 ================
7
8 This module provides a command line interface (CLI) to orchestrator
9 modules (ceph-mgr modules which interface with external orchestration services).
10
11 As the orchestrator CLI unifies different external orchestrators, a common nomenclature
12 for the orchestrator module is needed.
13
14 +--------------------------------------+---------------------------------------+
15 | *host* | hostname (not DNS name) of the |
16 | | physical host. Not the podname, |
17 | | container name, or hostname inside |
18 | | the container. |
19 +--------------------------------------+---------------------------------------+
20 | *service type* | The type of the service. e.g., nfs, |
21 | | mds, osd, mon, rgw, mgr, iscsi |
22 +--------------------------------------+---------------------------------------+
23 | *service* | A logical service, Typically |
24 | | comprised of multiple service |
25 | | instances on multiple hosts for HA |
26 | | |
27 | | * ``fs_name`` for mds type |
28 | | * ``rgw_zone`` for rgw type |
29 | | * ``ganesha_cluster_id`` for nfs type |
30 +--------------------------------------+---------------------------------------+
31 | *daemon* | A single instance of a service. |
32 | | Usually a daemon, but maybe not |
33 | | (e.g., might be a kernel service |
34 | | like LIO or knfsd or whatever) |
35 | | |
36 | | This identifier should |
37 | | uniquely identify the instance |
38 +--------------------------------------+---------------------------------------+
39
40 The relation between the names is the following:
41
42 * A *service* has a specfic *service type*
43 * A *daemon* is a physical instance of a *service type*
44
45
46 .. note::
47
48 Orchestrator modules may only implement a subset of the commands listed below.
49 Also, the implementation of the commands are orchestrator module dependent and will
50 differ between implementations.
51
52 Status
53 ======
54
55 ::
56
57 ceph orch status
58
59 Show current orchestrator mode and high-level status (whether the module able
60 to talk to it)
61
62 Also show any in-progress actions.
63
64 Host Management
65 ===============
66
67 List hosts associated with the cluster::
68
69 ceph orch host ls
70
71 Add and remove hosts::
72
73 ceph orch host add <hostname> [<addr>] [<labels>...]
74 ceph orch host rm <hostname>
75
76 Host Specification
77 ------------------
78
79 Many hosts can be added at once using
80 ``ceph orch apply -i`` by submitting a multi-document YAML file::
81
82 ---
83 service_type: host
84 addr: node-00
85 hostname: node-00
86 labels:
87 - example1
88 - example2
89 ---
90 service_type: host
91 addr: node-01
92 hostname: node-01
93 labels:
94 - grafana
95 ---
96 service_type: host
97 addr: node-02
98 hostname: node-02
99
100 This can be combined with service specifications (below) to create a cluster spec file to deploy a whole cluster in one command. see ``cephadm bootstrap --apply-spec`` also to do this during bootstrap. Cluster SSH Keys must be copied to hosts prior.
101
102 OSD Management
103 ==============
104
105 List Devices
106 ------------
107
108 Print a list of discovered devices, grouped by host and optionally
109 filtered to a particular host:
110
111 ::
112
113 ceph orch device ls [--host=...] [--refresh]
114
115 Example::
116
117 HOST PATH TYPE SIZE DEVICE AVAIL REJECT REASONS
118 master /dev/vda hdd 42.0G False locked
119 node1 /dev/vda hdd 42.0G False locked
120 node1 /dev/vdb hdd 8192M 387836 False locked, LVM detected, Insufficient space (<5GB) on vgs
121 node1 /dev/vdc hdd 8192M 450575 False locked, LVM detected, Insufficient space (<5GB) on vgs
122 node3 /dev/vda hdd 42.0G False locked
123 node3 /dev/vdb hdd 8192M 395145 False LVM detected, locked, Insufficient space (<5GB) on vgs
124 node3 /dev/vdc hdd 8192M 165562 False LVM detected, locked, Insufficient space (<5GB) on vgs
125 node2 /dev/vda hdd 42.0G False locked
126 node2 /dev/vdb hdd 8192M 672147 False LVM detected, Insufficient space (<5GB) on vgs, locked
127 node2 /dev/vdc hdd 8192M 228094 False LVM detected, Insufficient space (<5GB) on vgs, locked
128
129
130
131
132 Erase Devices (Zap Devices)
133 ---------------------------
134
135 Erase (zap) a device so that it can be resued. ``zap`` calls ``ceph-volume zap`` on the remote host.
136
137 ::
138
139 orch device zap <hostname> <path>
140
141 Example command::
142
143 ceph orch device zap my_hostname /dev/sdx
144
145
146 Create OSDs
147 -----------
148
149 Create OSDs on a group of devices on a single host::
150
151 ceph orch daemon add osd <host>:device1,device2
152
153 or::
154
155 ceph orch apply osd -i <json_file/yaml_file>
156
157
158 or::
159
160 ceph orch apply osd --all-available-devices
161
162
163 For a more in-depth guide to DriveGroups please refer to :ref:`drivegroups`
164
165 Example::
166
167 # ceph orch daemon add osd node1:/dev/vdd
168 Created osd(s) 6 on host 'node1'
169
170
171 If the 'apply' method is used. You will be presented with a preview of what will happen.
172
173 Example::
174
175 # ceph orch apply osd --all-available-devices
176 NAME HOST DATA DB WAL
177 all-available-devices node1 /dev/vdb - -
178 all-available-devices node2 /dev/vdc - -
179 all-available-devices node3 /dev/vdd - -
180
181
182 .. note::
183 Output form Cephadm orchestrator
184
185 Remove an OSD
186 -------------------
187 ::
188
189 ceph orch osd rm <svc_id>... [--replace] [--force]
190
191 Removes one or more OSDs from the cluster.
192
193 Example::
194
195 # ceph orch osd rm 4
196 Scheduled OSD(s) for removal
197
198
199 OSDs that are not safe-to-destroy will be rejected.
200
201 You can query the state of the operation with::
202
203 # ceph orch osd rm status
204 NAME HOST PGS STARTED_AT
205 osd.7 node1 55 2020-04-22 19:28:38.785761
206 osd.5 node3 3 2020-04-22 19:28:34.201685
207 osd.3 node2 0 2020-04-22 19:28:34.201695
208
209
210 When no PGs are left on the osd, it will be decommissioned and removed from the cluster.
211
212
213 Replace an OSD
214 -------------------
215 ::
216
217 orch osd rm <svc_id>... --replace [--force]
218
219 Example::
220
221 # ceph orch osd rm 4 --replace
222 Scheduled OSD(s) for replacement
223
224
225 This follows the same procedure as the "Remove OSD" part with the exception that the OSD is not permanently removed
226 from the crush hierarchy, but is assigned a 'destroyed' flag.
227
228 **Preserving the OSD ID**
229
230 The previously set the 'destroyed' flag is used to determined osd ids that will be reused in the next osd deployment.
231
232 If you use OSDSpecs for osd deployment, your newly added disks will be assigned with the osd ids of their replaced
233 counterpart, granted the new disk still match the OSDSpecs.
234
235 For assistance in this process you can use the 'preview' feature:
236
237 Example::
238
239
240 ceph orch apply osd --service-name <name_of_osd_spec> --preview
241 NAME HOST DATA DB WAL
242 <name_of_osd_spec> node1 /dev/vdb - -
243
244 Tip: The name of your OSDSpec can be retrieved from **ceph orch ls**
245
246 Alternatively, you can use your OSDSpec file::
247
248 ceph orch apply osd -i <osd_spec_file> --preview
249 NAME HOST DATA DB WAL
250 <name_of_osd_spec> node1 /dev/vdb - -
251
252
253 If this matches your anticipated behavior, just omit the --preview flag to execute the deployment.
254
255
256 ..
257 Blink Device Lights
258 ^^^^^^^^^^^^^^^^^^^
259 ::
260
261 ceph orch device ident-on <dev_id>
262 ceph orch device ident-on <dev_name> <host>
263 ceph orch device fault-on <dev_id>
264 ceph orch device fault-on <dev_name> <host>
265
266 ceph orch device ident-off <dev_id> [--force=true]
267 ceph orch device ident-off <dev_id> <host> [--force=true]
268 ceph orch device fault-off <dev_id> [--force=true]
269 ceph orch device fault-off <dev_id> <host> [--force=true]
270
271 where ``dev_id`` is the device id as listed in ``osd metadata``,
272 ``dev_name`` is the name of the device on the system and ``host`` is the host as
273 returned by ``orchestrator host ls``
274
275 ceph orch osd ident-on {primary,journal,db,wal,all} <osd-id>
276 ceph orch osd ident-off {primary,journal,db,wal,all} <osd-id>
277 ceph orch osd fault-on {primary,journal,db,wal,all} <osd-id>
278 ceph orch osd fault-off {primary,journal,db,wal,all} <osd-id>
279
280 Where ``journal`` is the filestore journal, ``wal`` is the write ahead log of
281 bluestore and ``all`` stands for all devices associated with the osd
282
283
284 Monitor and manager management
285 ==============================
286
287 Creates or removes MONs or MGRs from the cluster. Orchestrator may return an
288 error if it doesn't know how to do this transition.
289
290 Update the number of monitor hosts::
291
292 ceph orch apply mon <num> [host, host:network...]
293
294 Each host can optionally specify a network for the monitor to listen on.
295
296 Update the number of manager hosts::
297
298 ceph orch apply mgr <num> [host...]
299
300 ..
301 .. note::
302
303 The host lists are the new full list of mon/mgr hosts
304
305 .. note::
306
307 specifying hosts is optional for some orchestrator modules
308 and mandatory for others (e.g. Ansible).
309
310
311 Service Status
312 ==============
313
314 Print a list of services known to the orchestrator. The list can be limited to
315 services on a particular host with the optional --host parameter and/or
316 services of a particular type via optional --type parameter
317 (mon, osd, mgr, mds, rgw):
318
319 ::
320
321 ceph orch ls [--service_type type] [--service_name name] [--export] [--format f] [--refresh]
322
323 Discover the status of a particular service or daemons::
324
325 ceph orch ls --service_type type --service_name <name> [--refresh]
326
327 Export the service specs known to the orchestrator as yaml in format
328 that is compatible to ``ceph orch apply -i``::
329
330 ceph orch ls --export
331
332
333 Daemon Status
334 =============
335
336 Print a list of all daemons known to the orchestrator::
337
338 ceph orch ps [--hostname host] [--daemon_type type] [--service_name name] [--daemon_id id] [--format f] [--refresh]
339
340 Query the status of a particular service instance (mon, osd, mds, rgw). For OSDs
341 the id is the numeric OSD ID, for MDS services it is the file system name::
342
343 ceph orch ps --daemon_type osd --daemon_id 0
344
345
346 .. _orchestrator-cli-cephfs:
347
348 Depoying CephFS
349 ===============
350
351 In order to set up a :term:`CephFS`, execute::
352
353 ceph fs volume create <fs_name> <placement spec>
354
355 Where ``name`` is the name of the CephFS, ``placement`` is a
356 :ref:`orchestrator-cli-placement-spec`.
357
358 This command will create the required Ceph pools, create the new
359 CephFS, and deploy mds servers.
360
361 Stateless services (MDS/RGW/NFS/rbd-mirror/iSCSI)
362 =================================================
363
364 The orchestrator is not responsible for configuring the services. Please look into the corresponding
365 documentation for details.
366
367 The ``name`` parameter is an identifier of the group of instances:
368
369 * a CephFS file system for a group of MDS daemons,
370 * a zone name for a group of RGWs
371
372 Sizing: the ``size`` parameter gives the number of daemons in the cluster
373 (e.g. the number of MDS daemons for a particular CephFS file system).
374
375 Creating/growing/shrinking/removing services::
376
377 ceph orch {mds,rgw} update <name> <size> [host…]
378 ceph orch {mds,rgw} add <name>
379 ceph orch nfs update <name> <size> [host…]
380 ceph orch nfs add <name> <pool> [--namespace=<namespace>]
381 ceph orch {mds,rgw,nfs} rm <name>
382
383 e.g., ``ceph orch mds update myfs 3 host1 host2 host3``
384
385 Start/stop/reload::
386
387 ceph orch service {stop,start,reload} <type> <name>
388
389 ceph orch daemon {start,stop,reload} <type> <daemon-id>
390
391 .. _orchestrator-cli-service-spec:
392
393 Service Specification
394 =====================
395
396 As *Service Specification* is a data structure often represented as YAML
397 to specify the deployment of services. For example:
398
399 .. code-block:: yaml
400
401 service_type: rgw
402 service_id: realm.zone
403 placement:
404 hosts:
405 - host1
406 - host2
407 - host3
408 spec: ...
409 unmanaged: false
410
411 Where the properties of a service specification are the following:
412
413 * ``service_type`` is the type of the service. Needs to be either a Ceph
414 service (``mon``, ``crash``, ``mds``, ``mgr``, ``osd`` or
415 ``rbd-mirror``), a gateway (``nfs`` or ``rgw``), or part of the
416 monitoring stack (``alertmanager``, ``grafana``, ``node-exporter`` or
417 ``prometheus``).
418 * ``service_id`` is the name of the service. Omit the service time
419 * ``placement`` is a :ref:`orchestrator-cli-placement-spec`
420 * ``spec``: additional specifications for a specific service.
421 * ``unmanaged``: If set to ``true``, the orchestrator will not deploy nor
422 remove any daemon associated with this service. Placement and all other
423 properties will be ignored. This is useful, if this service should not
424 be managed temporarily.
425
426 Each service type can have different requirements for the spec.
427
428 Service specifications of type ``mon``, ``mgr``, and the monitoring
429 types do not require a ``service_id``
430
431 A service of type ``nfs`` requires a pool name and contain
432 an optional namespace:
433
434 .. code-block:: yaml
435
436 service_type: nfs
437 service_id: mynfs
438 placement:
439 hosts:
440 - host1
441 - host2
442 spec:
443 pool: mypool
444 namespace: mynamespace
445
446 Where ``pool`` is a RADOS pool where NFS client recovery data is stored
447 and ``namespace`` is a RADOS namespace where NFS client recovery
448 data is stored in the pool.
449
450 A service of type ``osd`` is in detail described in :ref:`drivegroups`
451
452 Many service specifications can then be applied at once using
453 ``ceph orch apply -i`` by submitting a multi-document YAML file::
454
455 cat <<EOF | ceph orch apply -i -
456 service_type: mon
457 placement:
458 host_pattern: "mon*"
459 ---
460 service_type: mgr
461 placement:
462 host_pattern: "mgr*"
463 ---
464 service_type: osd
465 placement:
466 host_pattern: "osd*"
467 data_devices:
468 all: true
469 EOF
470
471 .. _orchestrator-cli-placement-spec:
472
473 Placement Specification
474 =======================
475
476 In order to allow the orchestrator to deploy a *service*, it needs to
477 know how many and where it should deploy *daemons*. The orchestrator
478 defines a placement specification that can either be passed as a command line argument.
479
480 Explicit placements
481 -------------------
482
483 Daemons can be explictly placed on hosts by simply specifying them::
484
485 orch apply prometheus "host1 host2 host3"
486
487 Or in yaml:
488
489 .. code-block:: yaml
490
491 service_type: prometheus
492 placement:
493 hosts:
494 - host1
495 - host2
496 - host3
497
498 MONs and other services may require some enhanced network specifications::
499
500 orch daemon add mon myhost:[v2:1.2.3.4:3000,v1:1.2.3.4:6789]=name
501
502 Where ``[v2:1.2.3.4:3000,v1:1.2.3.4:6789]`` is the network address of the monitor
503 and ``=name`` specifies the name of the new monitor.
504
505 Placement by labels
506 -------------------
507
508 Daemons can be explictly placed on hosts that match a specifc label::
509
510 orch apply prometheus label:mylabel
511
512 Or in yaml:
513
514 .. code-block:: yaml
515
516 service_type: prometheus
517 placement:
518 label: "mylabel"
519
520
521 Placement by pattern matching
522 -----------------------------
523
524 Daemons can be placed on hosts as well::
525
526 orch apply prometheus 'myhost[1-3]'
527
528 Or in yaml:
529
530 .. code-block:: yaml
531
532 service_type: prometheus
533 placement:
534 host_pattern: "myhost[1-3]"
535
536 To place a service on *all* hosts, use ``"*"``::
537
538 orch apply crash '*'
539
540 Or in yaml:
541
542 .. code-block:: yaml
543
544 service_type: node-exporter
545 placement:
546 host_pattern: "*"
547
548
549 Setting a limit
550 ---------------
551
552 By specifying ``count``, only that number of daemons will be created::
553
554 orch apply prometheus 3
555
556 To deploy *daemons* on a subset of hosts, also specify the count::
557
558 orch apply prometheus "2 host1 host2 host3"
559
560 If the count is bigger than the amount of hosts, cephadm still deploys two daemons::
561
562 orch apply prometheus "3 host1 host2"
563
564 Or in yaml:
565
566 .. code-block:: yaml
567
568 service_type: prometheus
569 placement:
570 count: 3
571
572 Or with hosts:
573
574 .. code-block:: yaml
575
576 service_type: prometheus
577 placement:
578 count: 2
579 hosts:
580 - host1
581 - host2
582 - host3
583
584 Configuring the Orchestrator CLI
585 ================================
586
587 To enable the orchestrator, select the orchestrator module to use
588 with the ``set backend`` command::
589
590 ceph orch set backend <module>
591
592 For example, to enable the Rook orchestrator module and use it with the CLI::
593
594 ceph mgr module enable rook
595 ceph orch set backend rook
596
597 Check the backend is properly configured::
598
599 ceph orch status
600
601 Disable the Orchestrator
602 ------------------------
603
604 To disable the orchestrator, use the empty string ``""``::
605
606 ceph orch set backend ""
607 ceph mgr module disable rook
608
609 Current Implementation Status
610 =============================
611
612 This is an overview of the current implementation status of the orchestrators.
613
614 =================================== ====== =========
615 Command Rook Cephadm
616 =================================== ====== =========
617 apply iscsi ⚪ ✔
618 apply mds ✔ ✔
619 apply mgr ⚪ ✔
620 apply mon ✔ ✔
621 apply nfs ✔ ✔
622 apply osd ✔ ✔
623 apply rbd-mirror ✔ ✔
624 apply rgw ⚪ ✔
625 host add ⚪ ✔
626 host ls ✔ ✔
627 host rm ⚪ ✔
628 daemon status ⚪ ✔
629 daemon {stop,start,...} ⚪ ✔
630 device {ident,fault}-(on,off} ⚪ ✔
631 device ls ✔ ✔
632 iscsi add ⚪ ✔
633 mds add ✔ ✔
634 nfs add ✔ ✔
635 rbd-mirror add ⚪ ✔
636 rgw add ✔ ✔
637 ps ✔ ✔
638 =================================== ====== =========
639
640 where
641
642 * ⚪ = not yet implemented
643 * ❌ = not applicable
644 * ✔ = implemented