找回密码
 注册
查看: 662|回复: 3

ceph osd 相关命令集合

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-7-22 09:28:31 | 显示全部楼层 |阅读模式
[root@ceph-2 ~]# ceph osd status: z  Z% f, D& n. I7 O/ u. |6 l6 h7 {
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+& `4 ^/ g9 M9 ?
| id |       host       |  used | avail | wr ops | wr data | rd ops | rd data |   state   |# ]0 L2 L  w5 E
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+; K) G3 s2 J9 S# @' ~, o* T
| 0  | ceph-1.novalocal | 5227M | 94.8G |    0   |     0   |    0   |     0   | exists,up |% ~" \- ~; h' ]0 I
| 1  | ceph-1.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
0 ^- c' }6 a# }1 Q/ n% y| 2  | ceph-2.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |: ~9 V( e+ O; [) r
| 3  | ceph-2.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
, C" o, g) c/ p  ^6 z: s7 J| 4  | ceph-3.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |9 Z+ q/ m3 ~& S0 G
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
6 O/ G! X4 [0 L[root@ceph-2 ~]# ceph osd dump 5 z+ Y% E- l  z4 n) C% ^5 @
epoch 49
- X' z$ Q5 B! F0 O5 qfsid 57bf4711-2218-46af-99d6-9c68ae230ce1
4 g; p' L4 Y8 v" wcreated 2022-07-18 14:35:55.213289
1 ^2 }$ A: y% [4 y" ?: n, b7 i, Dmodified 2022-07-22 09:15:56.481196
7 M- z' C+ E3 b0 w4 Q; Pflags sortbitwise,recovery_deletes,purged_snapdirs1 s3 z0 ^/ d( x( D( \; ?
crush_version 24! {% |% ^+ r. M: [
full_ratio 0.95
  L1 _- o4 b1 @4 Z! W' gbackfillfull_ratio 0.9
$ d% n( v7 F5 a8 }8 s& t5 g8 Hnearfull_ratio 0.85
0 \% A+ @. w9 E, u7 R" W+ trequire_min_compat_client jewel* L3 B( R. Y1 [; U- k7 i5 m
min_compat_client jewel. t! f  \' E. W4 {, H7 v
require_osd_release luminous3 C4 M+ h- T( ?# H# N
max_osd 5
- s3 U3 z/ V1 G1 Y4 S0 c# bosd.0 up   in  weight 1 up_from 40 up_thru 0 down_at 33 last_clean_interval [24,32) 192.168.120.23:6801/29312 192.168.120.23:6802/29312 192.168.120.23:6803/29312 192.168.120.23:6804/29312 exists,up a0870816-e235-4abe-a951-21cea538944b
5 a/ l. o5 V8 V9 wosd.1 up   in  weight 1 up_from 27 up_thru 0 down_at 0 last_clean_interval [0,0) 192.168.120.23:6805/20931 192.168.120.23:6806/20931 192.168.120.23:6807/20931 192.168.120.23:6808/20931 exists,up c93215ac-b6be-41a3-b49f-32f58b573ac3+ q$ n% h: m, Q$ m
osd.2 up   in  weight 1 up_from 30 up_thru 0 down_at 0 last_clean_interval [0,0) 192.168.120.16:6800/10624 192.168.120.16:6801/10624 192.168.120.16:6802/10624 192.168.120.16:6803/10624 exists,up 5de4831f-4607-41fb-b068-6ceed8cd7c7f# J$ H1 `2 ~* ^' a+ F3 P
osd.3 up   in  weight 1 up_from 43 up_thru 0 down_at 0 last_clean_interval [0,0) 192.168.120.16:6804/12167 192.168.120.16:6805/12167 192.168.120.16:6806/12167 192.168.120.16:6807/12167 exists,up 297a9d7d-10b3-41cf-acda-886a38a9430a9 S8 v! z$ _6 p" C$ G# J1 U
osd.4 up   in  weight 1 up_from 46 up_thru 0 down_at 0 last_clean_interval [0,0) 192.168.120.31:6800/10016 192.168.120.31:6801/10016 192.168.120.31:6802/10016 192.168.120.31:6803/10016 exists,up ad1d7272-46c3-45ef-8aee-0d08ad8d6be6
3 s) s9 ^& w0 P[root@ceph-2 ~]# 2 x% O! V' f1 b: _) g" ~

. |- C1 b! ]& L8 I9 u, t: q[root@ceph-2 ~]# ceph osd df tree
: p" k- R2 C" B+ Q; ~9 Z3 B1 NID CLASS WEIGHT REWEIGHT SIZE    USE     AVAIL   %USE VAR  PGS TYPE NAME       ; Z; o0 m) b: [$ j' N
-9            0        -      0B      0B      0B    0    0   - host root      
; q/ A! S3 l( o-1            0        -  500GiB 9.13GiB  490GiB 1.83 1.00   - root default    : ^; U/ h. x3 I
-2            0        -  200GiB 6.11GiB  194GiB 3.06 1.67   -     host ceph-1
2 O0 ^. L% ?, Q6 u; ^: ^ 0   hdd      0  1.00000  100GiB 5.11GiB 94.8GiB 5.11 2.79   0         osd.0   : t* Y) [7 c5 V4 c' d/ m, X7 h
1   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.1   4 u3 O3 g8 B5 v7 q& C3 n
-3            0        -  200GiB 2.01GiB  198GiB 1.01 0.55   -     host ceph-2
1 A7 C5 R' w& e 2   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.2   
7 x3 S8 s9 j" ^: G, N) Q 3   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.3   
4 c- e. ^. M: h-4            0        - 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   -     host ceph-3
2 E7 V5 S8 w4 s 4   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.4   " ~5 J/ w3 a3 h: C, E
                   TOTAL  500GiB 9.13GiB  490GiB 1.83                          ) |+ i7 j0 ]  A0 r
MIN/MAX VAR: 0.55/2.79  STDDEV: 1.646 \9 k) |& O; M% y0 A
8 |$ U. x9 H5 w+ D0 j  [& L9 E5 R+ Z
[root@ceph-2 ~]# ceph osd df plain
+ I& @1 c4 e0 X/ \ID CLASS WEIGHT REWEIGHT SIZE    USE     AVAIL   %USE VAR  PGS 2 X5 o- B! ]$ U/ L& T6 k7 U6 e
0   hdd      0  1.00000  100GiB 5.11GiB 94.8GiB 5.11 2.79   0
8 v. K) b( F4 [0 E- E 1   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0 * L( ?% I* w% p# ^9 G
2   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
" A( b! O9 I( W/ o2 } 3   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0 ' C5 t: p! K( [1 r
4   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
# y! O9 X1 y+ }                   TOTAL  500GiB 9.13GiB  490GiB 1.83          8 p' `" v7 J4 P/ E2 `+ r
MIN/MAX VAR: 0.55/2.79  STDDEV: 1.642 s+ J7 H9 k5 E

! |: n6 u' c( }( P5 T, [: d

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 09:53:03 | 显示全部楼层
手动控制PG的Primary OSD
6 N( Z8 [8 M0 _! S" t        可以通过手动修改osd的权重以提升 特定OSD被选为PG Primary OSD的概率,避免将速度慢的磁盘用作primary osd4 c- F. V; M7 P7 u# \) S

+ b5 L" M* @/ `5 ^6 E4.1 查看osd.4为主的pg
$ [- c- @; g0 f. f- C5 p[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"
. F' j" x3 L" i  x3 D) f- u
0 l: h( V" M3 d1 Adumped all                          #查看OSD.4位主的PG; Y( z- j, Q1 J: `- w% B
1.7e          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.280490        0'0    311:517 [4,0,8]          4 [4,0,8]              4        0'0 2019-03-27 13:28:30.900982             0'0 2019-03-24 06:16:20.594466
1 I& h6 r2 m( B3 T1.7b          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256673        0'0    311:523 [4,6,5]          4 [4,6,5]              4        0'0 2019-03-28 02:46:27.659275             0'0 2019-03-23 09:10:34.438462 9 l& A- H" L. Q3 H/ n$ y
15.77         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.282033        0'0    311:162 [4,5,0]          4 [4,5,0]              4        0'0 2019-03-28 04:25:28.324399             0'0 2019-03-26 17:10:19.390530 1 h0 X3 Q  A5 W9 j0 \4 p
1.77          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:34:03.733420        0'0    312:528 [4,0,5]          4 [4,0,5]              4        0'0 2019-03-28 08:34:03.733386             0'0 2019-03-27 08:26:21.579623 3 {: ?2 L; f, g+ o9 p! _
15.7a         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257051        0'0    311:158 [4,2,3]          4 [4,2,3]              4        0'0 2019-03-28 03:27:22.186467             0'0 2019-03-26 17:10:19.390530
5 j  ^2 E2 e- d2 g% \15.7c         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.273391        0'0    311:144 [4,0,8]          4 [4,0,8]              4        0'0 2019-03-27 17:59:38.124535             0'0 2019-03-26 17:10:19.390530 ' O' g) \5 j3 y+ O. X
1.72          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.276870        0'0    311:528 [4,8,0]          4 [4,8,0]              4        0'0 2019-03-28 06:36:06.125767             0'0 2019-03-24 13:59:12.569691
3 F4 w2 M+ Y8 q+ Q5 a15.7f         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258669        0'0    311:149 [4,8,0]          4 [4,8,0]              4        0'0 2019-03-27 21:48:22.082918             0'0 2019-03-27 21:48:22.082918
/ [# a) n2 d9 ?0 ^# U. |0 t15.69         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258736        0'0    311:150 [4,0,8]          4 [4,0,8]              4        0'0 2019-03-28 00:07:06.805003             0'0 2019-03-28 00:07:06.805003 3 a7 z3 \2 @9 `, E0 B0 K1 n
1.67          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.275098        0'0    311:517 [4,0,8]          4 [4,0,8]              4        0'0 2019-03-27 21:08:41.166673             0'0 2019-03-24 06:16:29.598240 ) t9 l3 ?9 ]" V% A
14.22         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257257        0'0    311:149 [4,5,6]          4 [4,5,6]              4        0'0 2019-03-27 20:32:16.816439             0'0 2019-03-26 17:09:56.246887
+ D& t' P3 f7 i14.29         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252788        0'0    311:151 [4,5,6]          4 [4,5,6]              4        0'0 2019-03-27 21:55:42.189434             0'0 2019-03-26 17:09:56.246887
& T, s0 Q, i* [9 q3 V" E5.21          2                  0        0         0       0  4210688  139      139  active+clean 2019-03-28 08:02:25.257694    189'139    311:730 [4,6,2]          4 [4,6,2]              4    189'139 2019-03-27 19:02:33.483252         189'139 2019-03-25 08:42:13.970938 ) S+ a$ r8 a- Q# D
14.2a         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256911        0'0    311:150 [4,6,5]          4 [4,6,5]              4        0'0 2019-03-27 18:09:45.512728             0'0 2019-03-26 17:09:56.246887 # b7 Q3 Z3 J( ~0 _6 Y
14.2b         0                  0        0         0       0        0    1        1  active+clean 2019-03-28 08:02:25.258316      214'1    311:162 [4,6,2]          4 [4,6,2]              4      214'1 2019-03-27 23:48:05.092971             0'0 2019-03-26 17:09:56.246887 7 j/ W& E" m7 m* t+ R. G
14.2d         1                  0        0         0       0       46    1        1  active+clean 2019-03-28 08:02:25.282383      214'1    311:171 [4,3,2]          4 [4,3,2]              4      214'1 2019-03-28 03:14:08.690676             0'0 2019-03-26 17:09:56.246887 - \/ X' ?) }# S7 X' C. O) L- e
15.2c         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258195        0'0    311:157 [4,3,5]          4 [4,3,5]              4        0'0 2019-03-28 02:03:17.819746             0'0 2019-03-28 02:03:17.819746
, ]- P) w: ?+ t  n* l2 l  t6.1a          1                  0        0         0       0       19    2        2  active+clean 2019-03-28 08:02:25.281807      161'2    311:267 [4,2,6]          4 [4,2,6]              4      161'2 2019-03-27 22:42:45.639905           161'2 2019-03-26 12:51:51.614941 2 @, E/ O8 u/ o& E7 T; F
5.18          4                  0        0         0       0    49168   98       98  active+clean 2019-03-28 08:02:25.258482     172'98    311:621 [4,8,3]          4 [4,8,3]              4     172'98 2019-03-27 21:27:03.723920          172'98 2019-03-27 21:27:03.723920
8 ~7 ^( C( l# `15.14         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252656        0'0    311:148 [4,6,5]          4 [4,6,5]              4        0'0 2019-03-27 19:56:18.466744             0'0 2019-03-26 17:10:19.390530 " [& T) q( k, z; H) V) D$ f
15.17         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256549        0'0    311:164 [4,5,0]          4 [4,5,0]              4        0'0 2019-03-27 23:58:46.490357             0'0 2019-03-26 17:10:19.390530 ' Y3 |! K$ y$ |; @+ E1 D
1.18          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.277674        0'0    311:507 [4,6,8]          4 [4,6,8]              4        0'0 2019-03-28 01:14:47.944309             0'0 2019-03-26 18:31:14.774358 7 Q4 t4 z2 m+ A' e$ J: Y: i6 O9 n, c
5.1c          2                  0        0         0       0       16  250      250  active+clean 2019-03-28 08:02:25.257857    183'250  311:19066 [4,2,6]          4 [4,2,6]              4    183'250 2019-03-28 05:42:09.856046         183'250 2019-03-25 23:36:49.652800 - Z' O, V) u. m) w- S/ T3 M: U; S: O; F
15.19         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257506        0'0    311:164 [4,2,3]          4 [4,2,3]              4        0'0 2019-03-28 00:39:31.020637             0'0 2019-03-26 17:10:19.390530 1 \  j8 w/ U- [& G7 V% _3 }7 H+ w2 K
16.7          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.282212        0'0     311:40 [4,3,2]          4 [4,3,2]              4        0'0 2019-03-28 01:11:12.974900             0'0 2019-03-26 21:40:00.073686
: R4 o* \+ M: O. ?4 {3 r6.e           0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258109        0'0    311:251 [4,6,2]          4 [4,6,2]              4        0'0 2019-03-27 06:36:11.963158             0'0 2019-03-27 06:36:11.963158 , `- f7 ~. j+ E, i; T
13.5          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257437        0'0    311:168 [4,0,2]          4 [4,0,2]              4        0'0 2019-03-27 19:52:21.320611             0'0 2019-03-26 13:31:34.012304
8 H4 U4 V- O* }0 b$ N: `) o16.19         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257560        0'0     311:42 [4,2,6]          4 [4,2,6]              4        0'0 2019-03-28 04:21:53.015903             0'0 2019-03-26 21:40:00.073686
( d" C. X* i0 l  Z: N3 A) u+ n7.1           3                  0        0         0       0     1813   14       14  active+clean 2019-03-28 08:02:25.257994     192'14    311:303 [4,2,3]          4 [4,2,3]              4     192'14 2019-03-27 12:08:04.858102          192'14 2019-03-27 12:08:04.858102
8 Q+ R. \, D* n! u2 }; z- K5 s4 l14.9          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252723        0'0    311:163 [4,3,5]          4 [4,3,5]              4        0'0 2019-03-28 04:45:30.060857             0'0 2019-03-28 04:45:30.060857
% }3 M1 `8 r8 _8 a5.1           3                  0        0         0       0  8404992  119      119  active+clean 2019-03-28 08:02:25.258586    189'119    311:635 [4,3,8]          4 [4,3,8]              4    189'119 2019-03-28 01:01:39.725401         189'119 2019-03-25 09:40:24.623173 & X' @- P, G- _7 v$ f5 \: i
13.6          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257198        0'0    311:157 [4,5,0]          4 [4,5,0]              4        0'0 2019-03-27 15:49:19.196870             0'0 2019-03-26 13:31:34.012304
* A$ Q! u& U7 X- e2 H5 R5.f           5                  0        0         0       0    86016  128      128  active+clean 2019-03-28 08:02:25.258053    183'128   311:1179 [4,2,3]          4 [4,2,3]              4    183'128 2019-03-27 12:15:30.134353         183'128 2019-03-22 12:21:02.832942 ! `# ?) I, l+ s% m% E
16.1d         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257306        0'0     311:42 [4,0,2]          4 [4,0,2]              4        0'0 2019-03-28 01:15:37.043172             0'0 2019-03-26 21:40:00.073686
/ d% b% d& J4 z# J& [12.0          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258535        0'0    311:140 [4,6,8]          4 [4,6,8]              4        0'0 2019-03-27 15:42:11.927266             0'0 2019-03-26 13:31:31.916623
6 ^; }" ^" W% {16.1f         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258248        0'0     311:41 [4,0,5]          4 [4,0,5]              4        0'0 2019-03-28 08:01:48.349363             0'0 2019-03-28 08:01:48.349363
2 R* o2 x9 Q$ f9 Z: _: y9.6           0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257612        0'0    311:211 [4,2,3]          4 [4,2,3]              4        0'0 2019-03-27 23:02:31.386965             0'0 2019-03-27 23:02:31.386965 - V6 L5 Z" Z5 O  B6 t# y& e. T
1.f           0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.279868        0'0    311:503 [4,3,8]          4 [4,3,8]              4        0'0 2019-03-28 07:41:02.022670             0'0 2019-03-24 07:50:30.260358 / G6 s' q1 G' R0 M" V
1.10          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257936        0'0    311:538 [4,2,0]          4 [4,2,0]              4        0'0 2019-03-28 01:43:31.429879             0'0 2019-03-23 06:36:38.178339 7 ^2 F6 q: G% {: {( ^6 H6 ]
1.12          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256725        0'0    311:527 [4,3,5]          4 [4,3,5]              4        0'0 2019-03-28 04:49:49.213043             0'0 2019-03-25 17:35:25.833155
: o6 B$ I; m; O& F/ ?0 u. h: r7 p16.2          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.278599        0'0     311:31 [4,6,8]          4 [4,6,8]              4        0'0 2019-03-28 07:32:10.065419             0'0 2019-03-26 21:40:00.073686
: d& ^3 J& p( f& A* h6 e5 x15.1d         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252838        0'0    311:155 [4,5,3]          4 [4,5,3]              4        0'0 2019-03-28 00:50:04.416619             0'0 2019-03-26 17:10:19.390530
4 E0 S. h8 j: _: y5 A/ Q! J5.2a          0                  0        0         0       0        0  107      107  active+clean 2019-03-28 08:02:25.281096    172'107    311:621 [4,6,8]          4 [4,6,8]              4    172'107 2019-03-27 23:39:40.781443         172'107 2019-03-25 17:35:38.835798
  T4 z) ^5 D- ]& h5.2b          7                  0        0         0       0 16826368  225      225  active+clean 2019-03-28 08:02:25.257363    189'225   311:2419 [4,0,5]          4 [4,0,5]              4    189'225 2019-03-27 10:24:42.972494         189'225 2019-03-25 04:13:33.567532
( ?  Q; l6 a, c1.31          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256401        0'0    311:514 [4,5,6]          4 [4,5,6]              4        0'0 2019-03-27 20:39:23.076113             0'0 2019-03-25 10:06:22.224727
: z! u% x4 ~3 c2 p& @3 s5.31          1                  0        0         0       0  4194304  113      113  active+clean 2019-03-28 08:02:25.282326    189'113    311:661 [4,2,3]          4 [4,2,3]              4    189'113 2019-03-27 23:35:50.633871         189'113 2019-03-25 10:27:03.837772
6 a: X/ q, f5 A( S7 ]1 S5 w+ [9 w3 y" ~6 v14.37         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.282270        0'0    311:153 [4,5,0]          4 [4,5,0]              4        0'0 2019-03-27 20:36:25.969312             0'0 2019-03-26 17:09:56.246887 4 z; E9 T; l+ z$ Y
15.34         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258369        0'0    311:132 [4,8,3]          4 [4,8,3]              4        0'0 2019-03-27 23:30:49.442053             0'0 2019-03-26 17:10:19.390530
" T5 s6 g' L0 h3 o  Y1.43          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.279242        0'0    311:501 [4,6,8]          4 [4,6,8]              4        0'0 2019-03-27 21:59:51.254952             0'0 2019-03-26 13:16:37.312462 8 C/ [6 G1 v7 {9 `* L
1.48          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.281910        0'0    311:534 [4,0,5]          4 [4,0,5]              4        0'0 2019-03-27 23:47:00.053793             0'0 2019-03-24 04:51:10.218424 2 J/ l2 y/ y  x& ?
15.45         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.258421        0'0    311:155 [4,0,8]          4 [4,0,8]              4        0'0 2019-03-28 01:39:15.366349             0'0 2019-03-26 17:10:19.390530 6 q9 s6 e$ k# e+ b) U# ?  w
1.4e          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252906        0'0    311:519 [4,5,3]          4 [4,5,3]              4        0'0 2019-03-27 20:50:17.495390             0'0 2019-03-21 01:02:41.709506 - ~+ Y  D& P3 a  P$ A6 k+ a
1.51          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.281974        0'0    311:530 [4,6,2]          4 [4,6,2]              4        0'0 2019-03-28 07:23:04.730515             0'0 2019-03-26 00:23:54.419333 , ?" Q% w  y' o- i; F8 H
15.5a         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.257140        0'0    311:158 [4,0,2]          4 [4,0,2]              4        0'0 2019-03-28 00:12:17.000955             0'0 2019-03-26 17:10:19.390530
* k1 c) y/ v, M1.56          0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.256961        0'0    311:521 [4,5,3]          4 [4,5,3]              4        0'0 2019-03-27 16:24:10.512235             0'0 2019-03-27 16:24:10.512235
& a( x6 i! r$ A7 K6 T% d15.50         0                  0        0         0       0        0    0        0  active+clean 2019-03-28 08:02:25.252599        0'0    311:154 [4,5,3]          4 [4,5,3]              4        0'0 2019-03-28 00:25:01.475477             0'0 2019-03-26 17:10:19.390530 . e0 E$ m/ J$ \  l
统计
* I8 M4 C' t0 U! j3 I
) ?8 c! S$ s3 F1 m# S' _5 I[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l2 O2 K& t( F; z  K5 s# t; }

! |8 w. M% J% R7 p  w8 y- adumped all
" G4 n! z6 w8 M/ y' H56, K/ B' t. m7 B- W: T6 q
4.2 权重设为0
$ ?% a1 i6 ~- K3 h[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0
4 C' }7 {+ A3 {  ?% f1 M. Y
0 C# A7 f7 }! h; \Error EPERM: you must enable 'mon osd allow primary affinity = true' on the mons before you can adjust primary-affinity.  note that older clients will no longer be able to communicate with the cluster.
/ g$ r& k; y% {/ _7 r[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary
' \' U: |8 h* I  P8 y) n/ M3 R- k" c- X* N& {  }
   "mon_osd_allow_primary_affinity": "false",( `4 N) s' b* [% B: |6 p1 j
    "mon_osd_allow_primary_temp": "false",9 Q8 s6 a! s4 e" t
4.3 修改配置文件+ d8 y$ K# e- L0 V& w: U5 ~; e
[root@ceph1 ~]# vim  /etc/ceph/ceph.conf" U( R; w3 s( A1 n/ I$ g

6 G0 E3 }. b. F2 G6 }[global]( G8 e: h$ S5 N2 l4 A' Y7 m
fsid = 35a91e48-8244-4e96-a7ee-980ab989d20d
( n( I& j/ L. K- Q# u) a3 v5 \mon initial members = ceph2,ceph3,ceph4
9 a* z" n! b3 ~3 ?+ u% Fmon host = 172.25.250.11,172.25.250.12,172.25.250.13
! F& p& }/ P2 S4 I$ epublic network = 172.25.250.0/24( c) d/ Z7 T7 }: _& y
cluster network = 172.25.250.0/24. ]/ }5 S8 S( y8 W2 h2 m0 o+ ]
auth_cluster_required = cephx
2 [+ Z+ _! U( E1 c$ Q5 Y( x2 B( nauth_service_required = cephx  C: ^+ u8 o( K3 T
auth_client_required = cephx
6 ?. W  M  p( C  V; W$ a2 r2 V[osd]; S+ y+ H' U' G, z3 t6 W
osd mkfs type = xfs1 P- [2 F9 V" }
osd mkfs options xfs = -f -i size=20487 G% [% O) s# g; J; T; l1 J
osd mount options xfs = noatime,largeio,inode64,swalloc+ S: Y) C' A. d+ S! v
osd journal size = 5120
1 K2 ]7 G) r- }+ g! D/ ?9 Y* n+ P. @2 v, N4 O: Z
[mon]+ E7 U3 b5 m$ t; W
mon_allow_pool_delete = true
, [( Z* `3 G0 {& v4 imon_osd_allow_primary_affinity = true1 b+ S8 q. P3 M2 D" L
[root@ceph1 ~]# ansible all -m copy -a 'src=/etc/ceph/ceph.conf dest=/etc/ceph/ceph.conf owner=ceph group=ceph mode=0644'5 D5 z$ @/ _3 ]/ E6 L

0 W2 u* U0 P2 n4 J: ?, t[root@ceph1 ~]# ansible mons -m shell -a ' systemctl restart ceph-mon.target'
8 K7 ?7 j5 a( k" [+ ^4 L5 R% z: L) h) b: _/ P/ @8 G3 R/ k" ~, d
[root@ceph1 ~]# ansible mons -m shell -a ' systemctl restart ceph-osd.target'" a+ F+ z1 ~1 H; D: b

  N" m: c7 d- E: i0 m[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary# L5 C7 v/ J( \& E' I% x
5 _9 g- a) H( W, m" X
3 a& p, `  V* H& }# @4 d8 {

& i8 G+ _6 T  p没有生效
6 ~8 ~5 d* n( g' t5 n1 M# a2 U; b8 f# E( ^, z- h3 v
4.5 使用命令行修改
; N; T8 \5 v5 N/ k6 l[root@ceph2 ceph]# ceph tell mon.* injectargs '--mon_osd_allow_primary_affinity=true'
: s6 K  y# [- q8 g/ y+ |1 u3 @1 i9 K) g
mon.ceph2: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart) & S6 Y& f2 |$ D, o5 Q! ^) m
mon.ceph3: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart) ; [* \% I( W6 j8 b3 G7 f
mon.ceph4: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart)
4 c7 q$ F$ G: R$ B$ [* n7 M7 q[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary4 ~1 @! j4 |/ d% V0 L) X5 r

5 A. |% L9 r! p- F) h) s$ p- s. |7 f9 N( A0 i6 P
' b8 N; ?' F7 M7 y, X0 S
[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l
* f6 i7 C1 B. e  W8 Q# p* j3 W
& ]1 Y( ]8 i9 y" V: Pdumped all8 }, ^$ B7 ~- k. |3 [6 s% P
566 s# o4 \. n3 i$ B6 |
4.6 修改权重/ h* U$ t9 _$ y3 x, p0 ?/ q# g- V
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l/ k3 f- h3 o( j
dumped all
. k0 C: G  |; S3 ]56& E  ^( x  ^0 o5 B& y
[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0% i8 a# d) n$ b; ?
set osd.4 primary-affinity to 0 (802)' `5 J/ B, M/ _) v: s
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l7 j* g( M7 g$ v% I" p" e6 {# G
dumped all
; J; ~* G6 z* C) w56! p, V' e" g6 a3 q3 R% l
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l
; ^# V& f) Y  C- W% X! D0 f2 Ydumped all0 t3 p& g( M! u0 Q! }7 z/ q
56
0 E) s0 d  f# R9 q1 x) O" N[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l2 @3 V+ h3 Q- x  g, y4 ~6 j
dumped all5 m! ~( z. y* J/ Z8 W
0
- U4 ?2 \/ A" R+ R[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0.5* _( V1 G) |$ l7 g* ~) h; e
set osd.4 primary-affinity to 0.5 (8327682)! K! v) |" R" M% H! o1 r7 i
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l5 ]4 y! L- R9 L- r+ S( u5 A- O
dumped all" v1 V3 F. x' _4 G! N
26
# ]2 x- O% X. h6 s5 i2 l. [+ e[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l0 @2 \7 F4 M3 ~. Q% v+ @
dumped all
, l: n  [* t0 L! r& D' Z8 _& L* E265 z4 ]5 p/ ~# H) r: b& k
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l6 Q& f$ H6 W/ ^
dumped all) A" c3 p/ e" N3 P. _7 \
26

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 11:07:44 | 显示全部楼层
[root@ceph-2 ~]# ceph osd status  & j# }7 F$ D+ k$ |* M7 r
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
5 u  M! s8 Q& F) \' ?; K" J| id |       host       |  used | avail | wr ops | wr data | rd ops | rd data |   state   |5 u5 }9 W1 W; c6 u
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
7 W2 p. \- |# X0 e/ _8 l; }| 0  | ceph-1.novalocal | 5227M | 94.8G |    0   |     0   |    0   |     0   | exists,up |
+ d0 }- O# V5 M& u2 |" N% T( E- s| 1  | ceph-1.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
# z! _+ r0 e6 f9 T/ k) k! r| 2  | ceph-2.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
. o' F( a; [, f" h/ k7 r; [* e| 3  | ceph-2.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |6 Y' Z8 A. [: a+ C
| 4  | ceph-3.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |7 E& u! v, H# V3 F  D, Z* q
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+8 v8 O6 d# x1 w; h
[root@ceph-2 ~]#  ceph osd dump | grep ratio3 K  V6 ~9 V& ]0 n% j3 w. U
full_ratio 0.95
' x0 ~0 ], S/ N$ jbackfillfull_ratio 0.9) F/ `& C; {( Y4 z# x9 k
nearfull_ratio 0.85
: {- W7 J6 N3 }[root@ceph-2 ~]#

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 11:08:37 | 显示全部楼层

9 _6 B9 a# }& W1 t! \0 uHow to set/unset noout:
& Z  b. k. z2 j3 w
- U. {3 F% h( {, m" hceph osd set noout
) v! W( E  w- I3 k) jceph osd unset noout
! c) R: j0 X5 N+ [2 I! H' h3 Q+ V1 j3 I% Q
To get the cluster out of this state, data needs to be pushed away or removed from the OSDs in question. In the below example it is a single OSD in question (osd.52), but there could be many OSDs that are marked full.  
" s) o; ?) e; G7 K& Q% Z+ _2 \2 B. Z! m
To push data away from the osd, run:2 t% J) K6 j6 t& x

6 I3 L+ H, u2 S6 \( o0 g# `" Nceph osd reweight $osdID $Weight
$ G9 h4 ^' @2 H  V  d! i2 S0 V2 j/ C! g# [, `0 [2 j
Where $osdID is the OSD number "52" and $Weight is a value below 1, for example:: L+ H+ E% M( {' n- ^
* D; R0 \, r& {& u& l% `& Y& D
ceph osd reweight 52 .85' \; r1 H$ |5 q! l9 s/ h; {6 B5 q

1 B4 Y6 A! l. ~! dThe first objective is to get the OSDs that are full below 95% capacity, so the OSDs /pool(s)/cluster is not marked Read Only.  It is possible to achieve this goal with a $Weight of .95 in some cases, and in other cases, it may require a lower value, .90, .85, .80, etc.# y$ I# u2 h* N5 Z. ~  L, u

* e+ w9 f& W9 d4 Z, h( A' dThe second objective is to get the OSDs in question first below 90%, then below 85% of capacity.  This is achieved by continuing to monitor the cluster and re-weighting down the OSDs in question.  This process can take a few hours to complete.% v# ]6 z- x  B- ^

6 ^0 s* j) ^! M0 W1 IKeep in mind that when data is being pushed away or removed from an OSD, that data is being placed on another OSD in the cluster.  This action can in turn cause other OSDs to fill up as well.  The administrator will need to monitor ALL OSDs with "ceph osd df tree" to ensure that proper action is taken.
2 g% g3 ?$ h, ]* Q, n, W$ |1 Z7 I5 B$ o& u6 P3 K$ |
In some cases it will be necessary to change the following settings temporarily:
# [: Y& [  s, `' s6 @: U
0 |- d1 d0 X5 \0 pceph osd set-nearfull-ratio <ratio>
; J8 k& ~1 b& c' D% X6 u* rceph osd set-backfillfull-ratio <ratio>
3 P3 I& g/ ?+ ^% V6 A: h& Pceph osd set-full-ratio <ratio>% R. S. t- O9 Q# w

  q/ }' V- I8 ?: [3 C, G2 ["ceph osd set-full-ratio .96" will change the "full_ratio" to 96% and remove the Read Only flag on OSDs which are 95% -96% full. If OSDs are 96% full it's possible to set "ceph osd set-full-ratio .97", however, do NOT set this value too high.  e9 Y' }; w( v/ M* j# @+ m
# F1 Y& m5 v. g* C% m* W( ?. J" G
"ceph osd set-backfillfull-ratio 91" will change the "backfillfull_ratio" to 91% and allow backfill to occur on OSDs which are 90-91% full.  This setting is helpful when there are multiple OSDs which are full. % _) V0 u+ O+ n+ c

, ?* C3 O* r9 h( WIn some cases, it will appear that the cluster is trying to add data to the OSDs before the cluster will start pushing data away from the OSDs in question.  5 v4 C+ s$ s9 T* v: _. c
4 z9 I- U' g2 H
Once OSDs are below 95% capacity (full-ratio) or below the 90% capacity (backfillfull-ratio), set the setting sback to default:
0 Z, g; f; M4 ^4 R$ c
. \( R( a' o4 D+ j, oceph osd set-nearfull-ratio .85
6 W6 I2 H# z7 Y2 Y+ ]$ hceph osd set-backfillfull-ratio .90
$ y) }5 P4 Z3 j+ h7 E9 L* oceph osd set-full-ratio .95$ g2 \, U1 K" P

7 t5 G9 S1 V6 L4 V+ u0 }1 YThis will ensure that there is breathing room should any OSDs get marked full again at some point in time.  4 K5 m2 `3 P; ^- ^' z

/ d/ t/ |* u- Z7 SIf the Administrator is confident the issue addressed and it is safe to re-weight OSDs back up, it can be done in the same way:
& Y) J2 \6 l  G, {( B. _% U3 ?& g  d) K2 U: j
ceph osd reweight $osdID $Weight7 b0 j7 S3 j. I8 O  a7 {. W( ^" w

; X( {. _4 a7 f9 nWhere $osdID is the OSD number "52" and $Weight is a value up to 1:2 `7 L# ?4 `. W' c2 [
' F: z" @6 `6 \' k' L6 H0 y9 t# p
ceph osd reweight 52 .90% q2 A# z* p$ @. X0 h' A
    or
$ X8 |6 b( q$ jceph osd reweight 52 .95; O# L/ L  u5 R5 I+ ?- t$ y
    or, n; e4 h, \$ |+ T
ceph osd reweight 52 12 K2 N1 A5 Z. }; x3 }7 y. I

' r% A; T/ r+ E) L- i6 t2 u& g( s6 x2 @Monitor with:& Q' I1 z5 e" Z

- e1 t& B/ v0 x9 V) J/ |ceph -s+ J* F- ^& z7 \( k0 z8 ~
ceph health detail
0 A* q1 [' R( y1 O( A/ bceph osd df tree.  3 [* t5 |& `) y1 @; A+ G
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-11 23:03 , Processed in 0.029251 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表