|
|
楼主 |
发表于 2022-4-12 09:28:21
|
显示全部楼层
16 Operating Ceph Services REPORT DOCUMENTATION BUG#EDIT SOURCE
1 `8 U! W+ H0 s5 s. l16.1 Operating Ceph Cluster Related Services Using systemd$ y& F7 k" |" K. f9 [# t* K B( e
16.2 Restarting Ceph Services Using DeepSea* ?! v' z$ t* [$ K
16.3 Shutdown and Start of the Whole Ceph Cluster
! q: I. N& L: O g* C! FYou can operate Ceph services either using systemd or using DeepSea.. `6 {7 z1 g) c# K: J% a
) i1 L; C! d; i( b- m16.1 Operating Ceph Cluster Related Services Using systemd REPORT DOCUMENTATION BUG#EDIT SOURCE4 `2 j$ F6 |7 k
Use the systemctl command to operate all Ceph related services. The operation takes place on the node you are currently logged in to. You need to have root privileges to be able to operate on Ceph services.) t2 C ^2 i7 e
1 L, }+ ^2 v. {, W
16.1.1 Starting, Stopping, and Restarting Services Using Targets REPORT DOCUMENTATION BUG#EDIT SOURCE+ j7 \ {6 C( _3 k' X A( U4 A
To simplify starting, stopping, and restarting all the services of a particular type (for example all Ceph services, or all MONs, or all OSDs) on a node, Ceph provides the following systemd unit files:
( T+ X- P. @. n. ?9 f- b M% h6 g7 Z' R$ F1 g, G
ls /usr/lib/systemd/system/ceph*.target3 U8 T2 U% X! Q
ceph.target
; H" k3 b- |9 B: rceph-osd.target
/ t! H m' y3 X1 _% F2 ?ceph-mon.target
; d/ @6 e1 f- C( k" Iceph-mgr.target9 K# S# P/ B6 j) w
ceph-mds.target
( G8 A/ L6 G6 U5 ~% D, Qceph-radosgw.target
6 ~/ _: T M, m1 j7 ^' N/ jceph-rbd-mirror.target/ k: l3 S2 X. ? C
COPY- D( q( e. @* f7 {4 U
To start/stop/restart all Ceph services on the node, run:, a4 {2 i9 R0 p0 J2 M7 R
5 b7 B0 m& e/ h7 [
systemctl start ceph.target
! l& d" O$ L) g7 r+ jsystemctl stop ceph.target
k. _' Q8 \3 Jsystemctl restart ceph.target
1 O) i, z8 N aCOPY' I3 b* O5 @, x
To start/stop/restart all OSDs on the node, run:
* l% L! p3 R5 q' _3 j8 q; k& d" f- e1 s
systemctl start ceph-osd.target" T+ R, z* y" K S `/ \
systemctl stop ceph-osd.target
2 P: ]) Z$ U6 nsystemctl restart ceph-osd.target# f' {; g7 J. M; f% r3 P
COPY& W* G9 Z+ D' S& S- y" w; e
Commands for the other targets are analogous.( i* R6 y5 S5 ]3 G+ r# P
& r3 ?2 y7 Q* ~- i16.1.2 Starting, Stopping, and Restarting Individual Services REPORT DOCUMENTATION BUG#EDIT SOURCE- e4 A8 \: x: g: N6 C
You can operate individual services using the following parameterized systemd unit files:2 Q: F0 F/ Q( ?# a) t
3 T* I! V/ i3 s$ T! A9 Z, @
ceph-osd@.service
+ Z. @ S. O" g$ vceph-mon@.service; x$ X: d- Q8 B$ M
ceph-mds@.service! u$ g* ]) Z" W$ ]$ M
ceph-mgr@.service
5 G' \' Z9 i. s; P% }3 d2 p- [, Cceph-radosgw@.service
) n+ k% ~# P2 {6 u: ?, x% Oceph-rbd-mirror@.service
4 K& B% W e# G; T& P6 rCOPY3 v* V" M% J0 r: H4 x5 Y8 Z
To use these commands, you first need to identify the name of the service you want to operate. See Section 16.1.3, “Identifying Individual Services” to learn more about services identification.
, m5 p& q5 [0 K9 g# x; d: _
0 _6 d; e: T- N+ h5 O. Z/ s& \To start, stop or restart the osd.1 service, run:
6 E) A0 v: {+ K* K# q
5 m- [3 N" l$ y! x- ^systemctl start ceph-osd@1.service
0 y. k$ G8 J& fsystemctl stop ceph-osd@1.service, `# d, O1 |- B# J" J6 C: }
systemctl restart ceph-osd@1.service3 f! w. p& G3 e6 m9 [; W! w0 O# R
COPY' U/ \ q. q S- d# A: a
Commands for the other service types are analogous.
/ i# O1 ?3 ^6 \ K+ Z6 O7 K1 n0 ^9 v# R
' D5 m% p K+ g6 S; l6 W16.1.3 Identifying Individual Services REPORT DOCUMENTATION BUG#EDIT SOURCE# B7 N$ H" O: e% {( [4 g+ W
You can find out the names/numbers of a particular type of service in several ways. The following commands provide results for ceph* services. You can run them on any node of the Ceph cluster.
0 V2 H# f3 }3 E# s' G/ `# y+ V2 A
1 h, |( M3 p3 W0 P' TTo list all (even inactive) services of type ceph*, run:- i# b$ K# K4 N% u& D8 Q
0 F0 ^: w! h4 nsystemctl list-units --all --type=service ceph*
: j, N2 @5 M" V! ?9 @9 [+ GCOPY
4 \. `! m$ s) k* j' ], V9 VTo list only the inactive services, run:, X/ |- d7 \, w8 v
* n% X& s: R) J% K" F
systemctl list-units --all --state=inactive --type=service ceph*
0 l3 g1 | T2 {, _3 [- m; vCOPY, W( l5 R7 R1 t2 Y- t6 O( L
You can also use salt to query services across multiple nodes:1 p8 b6 d4 x' ^
% n# U. E+ Y# p! X/ H' ?
salt TARGET cmd.shell \
# z& _: ~( [3 } "systemctl list-units --all --type=service ceph* | sed -e '/^$/,$ d'"" Q0 U- f4 X2 ^1 y+ R& I9 |9 K+ X$ t
COPY
$ |0 k) M8 j6 C- f, g* w' Z% |Query storage nodes only:
- C7 l7 W: [. h9 h
$ z1 S% G0 Y, h7 D7 H* zsalt -I 'roles:storage' cmd.shell \$ n+ R- `) V+ F6 i0 U: x
'systemctl list-units --all --type=service ceph*') y; D; ?% O2 v/ r2 m0 m3 K1 j
COPY
: K2 ]- r/ S# C$ U! o Q3 a; g! r8 w16.1.4 Service Status REPORT DOCUMENTATION BUG#EDIT SOURCE
/ q1 Y8 ]# Z8 Z" `0 f! KYou can query systemd for the status of services. For example:5 ~4 Y' Y, c5 y9 t
; D' K$ n7 c/ h; y/ b1 T) f
systemctl status ceph-osd@1.service2 B9 \, h. {6 S, N+ N
systemctl status ceph-mon@HOSTNAME.service$ Q! @: A/ n( T
COPY
1 i' u {0 H+ [9 XReplace HOSTNAME with the host name the daemon is running on., A- S! J. u; p ]7 B1 A, `7 a. _! D L
' [: a( o+ J9 J: c! k* FIf you do not know the exact name/number of the service, see Section 16.1.3, “Identifying Individual Services”.* ?9 }! ]) y/ W% k, ^( U7 _
" J, ^" s. D# `1 t* Z0 D* Z16.2 Restarting Ceph Services Using DeepSea REPORT DOCUMENTATION BUG#EDIT SOURCE
$ C# D" j7 ]9 t; F7 ^- w* y0 HAfter applying updates to the cluster nodes, the affected Ceph related services need to be restarted. Normally, restarts are performed automatically by DeepSea. This section describes how to restart the services manually.5 N- V0 ^$ j: E& U; Q* o
+ ~) y; E$ j1 l" s, N+ L7 [TipTip: Watching the Restart2 S" a. K8 H5 ~. C4 H4 k1 a
The process of restarting the cluster may take some time. You can watch the events by using the Salt event bus by running:
; q. n' c7 j x4 @' v
+ S) Q/ {) c8 s* a9 O, I' qsalt-run state.event pretty=True
& s& H+ m) F, B- sCOPY
' F/ i( y$ y& g: @# [4 M) ZAnother command to monitor active jobs is+ k2 O. T( ]9 c; S6 w, p
; F( Y9 }+ ?; vsalt-run jobs.active
9 X! E& ~/ E8 w) j v" }COPY5 e# F7 R, M# {, R
16.2.1 Restarting All Services REPORT DOCUMENTATION BUG#EDIT SOURCE
, \. P' X3 |2 [% G/ qWarningWarning: Interruption of Services
1 _, Z. G2 X% c% O( {6 wIf Ceph related services—specifically iSCSI or NFS Ganesha—are configured as single points of access with no High Availability setup, restarting them will result in their temporary outage as viewed from the client side.1 y+ x9 c4 r; K" ~3 E
: t) g# _- t" v+ m! s% e) PTipTip: Samba Not Managed by DeepSea- s7 C) H( i" u3 _. {
Because DeepSea and the Ceph Dashboard do not currently support Samba deployments, you need to manage Samba related services manually. For more details, see Chapter 29, Exporting Ceph Data via Samba.
% U0 [3 a: U: ^" `8 u% f7 k+ F4 o% A7 @5 q/ f& r2 T8 Z' C
To restart all services on the cluster, run the following command:
$ X$ g* x/ b1 s- v" {% Z f5 s# t) f0 \
salt-run state.orch ceph.restart/ {2 \9 e( ?5 p2 c: i% L
COPY) m1 g5 `! t5 J: D$ b! H
For DeepSea prior to version 0.8.4, the Metadata Server, iSCSI Gateway, Object Gateway, and NFS Ganesha services restart in parallel.8 k; G' @3 Z. g; L* s7 e1 a
9 r7 `4 O. _9 w" m- s
For DeepSea 0.8.4 and newer, all roles you have configured restart in the following order: Ceph Monitor, Ceph Manager, Ceph OSD, Metadata Server, Object Gateway, iSCSI Gateway, NFS Ganesha. To keep the downtime low and to find potential issues as early as possible, nodes are restarted sequentially. For example, only one monitoring node is restarted at a time.7 Z5 ~! r: v4 E5 j3 A* e
( j0 Y2 w2 i) A( _+ ?
The command waits for the cluster to recover if the cluster is in a degraded, unhealthy state.- n+ I/ o! ]* R+ [' H
, ~) B3 t2 j! a1 X16.2.2 Restarting Specific Services REPORT DOCUMENTATION BUG#EDIT SOURCE
% m# [' y9 @- R5 ]* PTo restart a specific service on the cluster, run:5 l) O0 Z" ~+ m7 j" L
+ p0 b }- v( J1 M, v
salt-run state.orch ceph.restart.service_name% ]9 m. O5 M; L. g/ Z
COPY
+ R0 O( x' o) G4 UFor example, to restart all Object Gateways, run:, D* `& L3 _! K4 x3 T/ ^8 c5 u
& y$ j2 g: g4 csalt-run state.orch ceph.restart.rgw
$ U3 Y6 |4 ^ u3 {; l. F1 ECOPY
9 a7 O8 B- t- JYou can use the following targets:
7 {6 ^9 J$ ^9 ?/ B9 E
$ ^0 ~4 H, E6 v- l0 P, ]salt-run state.orch ceph.restart.mon2 y+ f& Q5 i8 ~5 ?% _9 @
COPY
! n0 {* c8 r8 N9 Isalt-run state.orch ceph.restart.mgr
& a, u2 y5 {# \0 t7 M( z" iCOPY" c8 [) M7 z7 k' m4 b
salt-run state.orch ceph.restart.osd
$ e+ t$ R, ^4 ^COPY
9 c6 j+ D' a( m+ H c Bsalt-run state.orch ceph.restart.mds3 S% ?" { V4 b
COPY6 j! n. t. E" J, `% Z3 e; C9 b
salt-run state.orch ceph.restart.rgw
# n0 h3 K: @* ^! K% T1 y3 O. l0 {COPY5 E B$ P8 x3 |3 ?
salt-run state.orch ceph.restart.igw) w7 B0 y; A4 s( H
COPY
( q( n' J8 p1 zsalt-run state.orch ceph.restart.ganesha
" u. l9 g" O& a) t* j1 p: f LCOPY
: U- _; g! b, ?# K6 [The restart orchestration checks if the installated binary is newer than the current one, or if configuration changes exist for this daemon and only restarts in those cases. If you run the above command and nothing happens, this is due to these conditions. See Section 16.1.2, “Starting, Stopping, and Restarting Individual Services” for more information.4 G, ^% i, n' \
: w3 H' @' F4 `5 F7 R
16.3 Shutdown and Start of the Whole Ceph Cluster REPORT DOCUMENTATION BUG#EDIT SOURCE
' ?6 z3 _" O& h/ QThere are occasions when you need to stop all Ceph related services in the cluster in the recommended order, and then be able to simply start them again. For example, in case of a planned power outage.+ O+ a P$ M0 \
# D3 ]2 l) w7 O5 i9 t8 O
PROCEDURE 16.1: SHUTTING DOWN THE WHOLE CEPH CLUSTER REPORT DOCUMENTATION BUG#
( z2 b3 Y% F2 NShut down or disconnect any clients accessing the cluster.
! n: M9 r; x0 y0 X
+ E+ X7 m0 E* ETo prevent CRUSH from automatically rebalancing the cluster, set the cluster to noout:
* X! f* w; j. {) Z1 W3 o! M% S! z- j9 m: i+ z% H
ceph osd set noout
3 _5 w) d; M( A1 e# }COPY
4 H5 X, K, X9 l4 g7 t- I3 s& EDisable safety measures and run the ceph.shutdown runner:4 T4 l. x# T$ w" o B
* ?) a: A" y( E3 R
salt-run disengage.safety! i1 j5 Q$ H5 e* v* ^4 z' M
salt-run state.orch ceph.shutdown- T% T" s z6 f! U3 c9 Y0 j3 @
COPY
( W8 t1 b# x2 N o. yPower off all cluster nodes:
* a. O9 v% F/ x; m6 g* r2 b+ p% D& T: e
salt -C 'G@deepsea:*' cmd.run "shutdown -h"9 F( f0 n' ]( G$ f9 E
COPY
3 X% w2 `) e" x! k vPROCEDURE 16.2: STARTING THE WHOLE CEPH CLUSTER REPORT DOCUMENTATION BUG#
# r8 q4 x2 `. u) { t2 Z0 u4 PPower on the Admin Node.
8 h! X. {, Y8 S, E3 s6 J) o4 g Q& F+ P* u1 U" L, ?
Power on the Ceph Monitor nodes.
+ f/ F6 m* w9 U2 F+ \) q9 o* F [! C' Q* I2 R/ ]3 K5 U
Power on the Ceph OSD nodes.
8 T; v6 c( W" B4 ~5 L" a) s, D! k
Unset the previously set noout flag:# z: i9 a8 I: x) t$ W* v. Y
* ~9 m0 f7 d' S* p( X" j+ G# p
ceph osd unset noout* C1 N. N; @: R* f5 y% ?# ]
COPY' ~) I% {+ V$ X- k% p
Power on all configured gateways.' V8 w: J/ r+ s( r' c& j
. |( m) D8 U' [( zPower on or connect cluster clients. |
|