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

ceph osd 相关命令集合

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-7-22 09:28:31 | 显示全部楼层 |阅读模式
[root@ceph-2 ~]# ceph osd status/ ]( X" C3 W, S: J) \' f& a; ~
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+4 J, _; N  m8 `2 _( ]3 ]/ Y
| id |       host       |  used | avail | wr ops | wr data | rd ops | rd data |   state   |
' h( Z2 b( R8 g; j# W% _+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
: w' a( k$ W3 f. s$ a2 o3 a$ a2 M| 0  | ceph-1.novalocal | 5227M | 94.8G |    0   |     0   |    0   |     0   | exists,up |+ U$ X- H( ~7 Z! \" {( p
| 1  | ceph-1.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
; m0 a) Q2 n5 j8 {| 2  | ceph-2.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
. m1 J1 f7 }- l  N$ U2 r| 3  | ceph-2.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |8 T$ G# y- N8 S) X
| 4  | ceph-3.novalocal | 1030M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
0 m% w( i/ F( T- J) r" p2 ]+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
/ R9 p- o5 N  f$ A0 M7 Y6 Z; M5 _[root@ceph-2 ~]# ceph osd dump 0 N! Z3 f% I( h; E* d
epoch 49  x- n  M2 c# C5 z1 m* S0 b" u
fsid 57bf4711-2218-46af-99d6-9c68ae230ce1' J( L  C% O; v: p  l9 k
created 2022-07-18 14:35:55.213289( ?! N* z6 ?9 v  r: Q6 @
modified 2022-07-22 09:15:56.481196
, x7 @3 K0 a/ w: }, uflags sortbitwise,recovery_deletes,purged_snapdirs
9 y1 G0 O  A' x2 j0 W  ]crush_version 24- q. l0 y3 g8 @( R
full_ratio 0.95
2 E+ Q8 O, L2 cbackfillfull_ratio 0.95 V9 \- c; w: X5 E5 D5 J) r. |
nearfull_ratio 0.85# K( C8 V% w7 u/ V! I* z% o
require_min_compat_client jewel
% {' k" z9 H, r/ p% t: D( Smin_compat_client jewel% B6 g7 e- l, f: i; D  l4 s/ D: {* |
require_osd_release luminous
: T. ]- q* K& t; L5 V$ f# \max_osd 5
2 t+ A6 i- M& z( u) x% W9 Q7 dosd.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
7 u/ R* c5 d* Hosd.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; x' [7 j# c) B) S; f' Y
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# j2 j& g3 H5 ~6 W7 i2 l+ x" \$ _/ J
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-886a38a9430a( i$ ]' Z- t5 w& Y  R
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; P2 G0 F4 R6 v( M
[root@ceph-2 ~]#
* P4 l3 P+ u7 m/ t. |, z4 \8 |7 ?& r2 I# ?
[root@ceph-2 ~]# ceph osd df tree
' A6 s2 m) }& k0 U8 yID CLASS WEIGHT REWEIGHT SIZE    USE     AVAIL   %USE VAR  PGS TYPE NAME       / K  Q6 E9 t0 o2 @
-9            0        -      0B      0B      0B    0    0   - host root      
/ t# w1 Q% I" V% n3 M-1            0        -  500GiB 9.13GiB  490GiB 1.83 1.00   - root default    / A- c2 w4 M, T' |$ g2 |! {
-2            0        -  200GiB 6.11GiB  194GiB 3.06 1.67   -     host ceph-1
! H. X, e0 N1 D 0   hdd      0  1.00000  100GiB 5.11GiB 94.8GiB 5.11 2.79   0         osd.0   
8 U' t. b. a# L1 T4 @ 1   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.1   
) L( E3 H! F6 `7 |! \7 A1 D-3            0        -  200GiB 2.01GiB  198GiB 1.01 0.55   -     host ceph-2 : \! m, N3 _1 x: U9 N& H  t4 d5 F; {
2   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.2   % o/ q; \+ ~+ B1 e: Y" t! A
3   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.3   
  T, N& M" t# A-4            0        - 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   -     host ceph-3 2 W) R& r' \/ Y
4   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0         osd.4     C  L8 y4 W$ W
                   TOTAL  500GiB 9.13GiB  490GiB 1.83                          9 Y" q9 [- g4 Q" @* R2 z& w
MIN/MAX VAR: 0.55/2.79  STDDEV: 1.644 Q7 Y/ X3 g/ p. h4 I" J3 I! S
' Q: S, V4 G! F( G" S2 p0 U, `0 w
[root@ceph-2 ~]# ceph osd df plain
1 [, j. {7 H9 I+ n1 b" M6 V1 {( [0 YID CLASS WEIGHT REWEIGHT SIZE    USE     AVAIL   %USE VAR  PGS
+ ^: b# N, l% ]# [0 o( ]  U: c5 X 0   hdd      0  1.00000  100GiB 5.11GiB 94.8GiB 5.11 2.79   0
% f9 N, Q3 H: v' J 1   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
# \6 _" Y) j& R7 ?. M1 w' e 2   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
# x4 {' y+ p) v9 u! g% G( c9 r 3   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
- ^* ~1 ]9 ^  F2 Y9 D 4   hdd      0  1.00000 99.9GiB 1.01GiB 98.9GiB 1.01 0.55   0
( m( ~4 A$ q2 I; Z; Z                   TOTAL  500GiB 9.13GiB  490GiB 1.83          ; @8 v* u: M. c* \
MIN/MAX VAR: 0.55/2.79  STDDEV: 1.64
1 H: [% x: j3 ]+ g! f/ W2 o1 E# C' o5 l3 H( _. R7 ^/ w

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 09:53:03 | 显示全部楼层
手动控制PG的Primary OSD% t, g( ?+ `6 s  H
        可以通过手动修改osd的权重以提升 特定OSD被选为PG Primary OSD的概率,避免将速度慢的磁盘用作primary osd
  J) `. l# |2 Q6 z
9 W- R0 v# C' Q4 A1 Q4.1 查看osd.4为主的pg
. j! Z8 O: R& j: B* W[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"5 c9 t* Y# E. b8 G" q+ K

. i% x7 X  \- M3 p' i" |dumped all                          #查看OSD.4位主的PG/ N# p) P' k0 Z) s6 [/ G
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
+ U8 B. E" N* q  `% K1.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 5 [: b+ M1 [$ }# @+ D* S% q" _
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 0 }4 M3 }1 C- K( l9 J3 ~4 X: M: X
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
, a% B- J4 l* c6 E1 t0 T+ f) v15.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
( N2 p, v* `! O: o6 T+ T2 n15.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 & B2 F3 s# c, P! c4 a& Z
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 + M" i- [( r* k7 L: C0 {( j+ h
15.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 ; P2 ^# n8 G2 c& H. c4 x  V
15.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 ( p- S4 c1 j/ L0 u
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
- o$ ~. d7 |8 R% \# N+ Y9 x5 j14.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
+ ]( X* v4 ~9 I* l, b14.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 # Z. K7 y% ^" {" Y: u9 e
5.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
5 c, `. R4 @( @& Z/ z14.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 $ K3 D% I, d+ 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 / n" |5 I0 @3 ?# V' R
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 / w2 M9 N) b( s! O
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
; t8 T3 |. V2 Q( x+ u" a6.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 1 x( V9 Z1 t. o7 W
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
7 p$ W7 e" f) G. D15.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
0 p/ {8 a5 E4 @$ o, X15.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
* X  f' N  L% |2 Y1 M+ F1.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 3 U9 q: s+ F1 q1 ^" j
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 7 F1 N" H/ ~- |3 a. @
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 ; G% y4 j% s8 q! f: r' k! G
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 3 U- i3 a4 Y- W
6.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
7 K. x& U  Q. c/ B& ^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
% b2 H% \+ b/ _9 E" M) W16.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
' b' M0 v9 M# y6 j: n2 W7.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
$ `5 N8 j6 C) l. l/ d14.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 2 b$ W, ~7 m2 e9 g* k0 F
5.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
: ^/ b4 `3 l, }; W0 x/ M13.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 ( `( O9 g  \+ e/ ^
5.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
) Q1 t- `0 c5 i16.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 - k/ ~7 ^3 {4 I7 }/ Q
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
. m" ^7 A2 m) o16.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 " Q( L0 U7 l, I; S" l
9.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 ( s1 K5 o" [- l2 L2 [
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
. @" f' m9 O4 d3 m' ]9 ?$ j" S( k; _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
- I9 T" |( M3 W+ q: ^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   ?1 [) e/ N, T7 C8 T8 Z" r
16.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
2 i2 w: M* h, ~- e3 _+ K7 w15.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
. u- o7 [. U. E( x% h  q& Y; j. s5.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
2 B9 }& A5 C' F7 \4 b0 b* f* e5.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
& e  {: H2 k; Y6 n1 F, W1.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
0 G% O' \, |$ x) o5.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 ' c9 t2 H" }1 \6 g% c
14.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
, f, {8 _  [% l0 F- ]8 N& O6 E7 g15.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 * E$ f$ I9 H) j5 Y5 f% [: F& Y/ ]2 m
1.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 * y- K; w) ]# \" I
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
5 S5 e6 B. k$ z1 h15.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
4 a* y4 H" o2 w% Y7 f' h1.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
! \3 u! y+ y) ^6 M2 A: ]4 a1.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
5 g5 D% K- \1 Q' Q9 j4 d15.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 % d6 I4 o6 J! B$ T4 Z5 E
1.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 ; u: K: {- E' F
15.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 ' b0 W! R. K; U7 X- y+ ^, O
统计& U5 E% r1 p: g8 j! P+ G% v
( c& @8 c) j, y1 N+ o
[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l8 A! d& n( c5 A
- D2 m0 X0 y# @9 N" c, |
dumped all+ b7 i1 C* c* W: F; Q' E: C
56
* d. Z, j7 l( ^! A! L& S4.2 权重设为0
7 [" g, |4 F. R/ E[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0
* J' O- z0 q* A# ^: t5 T! d. [% f# n2 {
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.4 P* P* Y& h# s
[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary
' x) T4 C% {) r# J: A6 K5 U
! Q. ^' o+ i8 F   "mon_osd_allow_primary_affinity": "false",
' W$ }& N6 s& X. B2 x" d7 i9 g    "mon_osd_allow_primary_temp": "false",( q" h/ ]# q* [+ e
4.3 修改配置文件
8 Z" V7 ~8 q1 P+ z[root@ceph1 ~]# vim  /etc/ceph/ceph.conf& z. j' \/ h8 N* H- d3 p( @9 {
( h7 E% w! g2 \" p. L" d
[global]' f4 j+ C) ]. a; i  l8 h6 Y7 u
fsid = 35a91e48-8244-4e96-a7ee-980ab989d20d
, p! H9 b- F% p5 }mon initial members = ceph2,ceph3,ceph4$ `. C8 W$ f) O9 m, J" L/ A# Z
mon host = 172.25.250.11,172.25.250.12,172.25.250.13
' U5 v$ Y6 {- M! npublic network = 172.25.250.0/24
) b5 b/ `9 p, C* ]8 }' U8 fcluster network = 172.25.250.0/24
3 y2 M+ B$ g: `7 qauth_cluster_required = cephx
, Y- L/ C+ E0 T$ X/ eauth_service_required = cephx" l/ x* J( G# Z& H7 [: I
auth_client_required = cephx
$ D- u: W( P6 H) J8 A! Z7 b0 q; Y[osd]/ M" `  x! h4 K. l
osd mkfs type = xfs+ a" Q. G2 U, ]/ y
osd mkfs options xfs = -f -i size=20489 A6 h: q3 A/ v' K
osd mount options xfs = noatime,largeio,inode64,swalloc
# S# g: L$ N# h1 ~4 Q6 T2 Q$ I) Josd journal size = 51200 r# b" S: O8 p( V+ O9 d

3 r% b/ l! K6 _# w3 O% L[mon]
% R3 u1 _1 P9 bmon_allow_pool_delete = true8 V. b, |' g% u, o! O$ q" `" {) z$ g+ K
mon_osd_allow_primary_affinity = true& ]/ \# L$ W* k; _! `
[root@ceph1 ~]# ansible all -m copy -a 'src=/etc/ceph/ceph.conf dest=/etc/ceph/ceph.conf owner=ceph group=ceph mode=0644'
1 Z7 E  I' i) q+ e
+ Y3 n7 j* U$ Q0 F[root@ceph1 ~]# ansible mons -m shell -a ' systemctl restart ceph-mon.target'* O9 a8 \# i9 ?6 }) L* ]' f

2 m7 }7 M5 g* S" M5 p7 B! k4 X: t) P[root@ceph1 ~]# ansible mons -m shell -a ' systemctl restart ceph-osd.target'
. ~, U6 Z# _2 P
! A& M, U( A0 m9 n: I; o& g[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary; q0 g/ ]( g& t! I
4 y/ c' d  }7 Q8 i/ |

9 R8 s+ B- E7 ~/ _
( W3 E) b5 t8 N没有生效  [% y# C" q! {

4 ]2 X4 o2 e7 I- Q4.5 使用命令行修改9 ~7 ]! y0 _7 t3 h
[root@ceph2 ceph]# ceph tell mon.* injectargs '--mon_osd_allow_primary_affinity=true'% \/ ?& b0 N* w! m! ~+ c+ ~
2 A' Y$ C2 l3 V1 O. S. q. Q, s0 t- D
mon.ceph2: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart)
& C3 r* A+ N( g1 }* k1 umon.ceph3: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart) % K+ p* E2 z: R
mon.ceph4: injectargs:mon_osd_allow_primary_affinity = 'true' (not observed, change may require restart) 9 I3 u' |9 k8 M! d, P8 ~' J4 N
[root@ceph2 ceph]# ceph daemon /var/run/ceph/ceph-mon.$(hostname -s).asok config show|grep primary
4 k# e+ S- F( @0 ?. }# L5 E" l, b' L7 G, ?$ \# i
  t8 z1 V+ I4 q$ U. z5 h4 k3 y

; r5 {1 z1 u; t0 C; |, T[root@ceph2 ceph]# ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l2 _4 Z$ s% Z+ `9 L+ W: x

: G1 H+ }4 {  k0 |9 Qdumped all
# P9 d" C9 z0 ^# O/ x* \# D0 ~# x56; X; }9 A: k8 O3 X/ \
4.6 修改权重
% i% ~* }6 `' v! g" \, R. I" X[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l
% ]1 V% L8 c9 r! h1 t- p! t) L9 ddumped all. O3 v+ B  ]" F- G
56, l9 b- l' _! X( ]0 ?
[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0' B4 T* D4 u: n$ y4 [
set osd.4 primary-affinity to 0 (802)
4 I+ L6 U- L% r& e3 Z& H[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l- r  l" F8 [4 ?* K# W) Q, p
dumped all% S) v5 c5 S* z: ^, L: G
56
+ z$ D$ \8 Z- X& a) E' j8 w, k; U[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l4 I7 L) E3 A5 f! ?" a# {+ ]; o" P. W
dumped all+ I- o7 B* \2 M$ P; O- }
56
- f( ~4 j* E- H4 H, B[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l
/ r% b: c* r+ C% _: ldumped all" @& a, V5 i5 }8 |- z$ v' r
0
+ i  T8 [% I0 `[root@ceph2 ceph]# ceph osd primary-affinity osd.4 0.5
1 ?4 h6 [: }5 @9 |* [% B  Xset osd.4 primary-affinity to 0.5 (8327682)
* w, i# x4 C$ @8 |[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l8 s. X1 l# I$ h: M
dumped all
8 G7 T# t+ i5 h; r# F- q) f/ I26. W( h( @/ _0 p0 F% |* D* b
[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l/ @) r6 x. z1 X; e- i' i
dumped all
. `- v3 r, y" ?8 y: a# C: A6 i1 I; c26
+ {: n! V3 P3 h: ~  V[root@ceph2 ceph]#  ceph pg dump|grep 'active+clean'|egrep "[4,"|wc -l2 g* r& C0 T, }+ o( ^
dumped all  E& X" Z7 ^7 H; F6 E8 v  t
26

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 11:07:44 | 显示全部楼层
[root@ceph-2 ~]# ceph osd status  . @5 c: d& a5 _$ B& `2 q' S- d
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+* q$ z2 \2 w. r* [( Q, u0 W
| id |       host       |  used | avail | wr ops | wr data | rd ops | rd data |   state   |  T% y3 C0 k& r% L
+----+------------------+-------+-------+--------+---------+--------+---------+-----------+
; `' B9 k) r+ B% i| 0  | ceph-1.novalocal | 5227M | 94.8G |    0   |     0   |    0   |     0   | exists,up |
9 t6 m7 _6 y& G# o  W) L6 A9 L| 1  | ceph-1.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |9 [0 q  `5 C/ d9 M+ ?9 G
| 2  | ceph-2.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |- S. W; x; h! r
| 3  | ceph-2.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |2 `, c" V9 @7 o# `
| 4  | ceph-3.novalocal | 1031M | 98.8G |    0   |     0   |    0   |     0   | exists,up |
: a: Z# b1 a. N! x$ z1 P' y$ A  P+----+------------------+-------+-------+--------+---------+--------+---------+-----------+- {' E* Z6 P/ ~# b
[root@ceph-2 ~]#  ceph osd dump | grep ratio
- T2 [/ W( W+ E" v- Y; lfull_ratio 0.95
7 p" M9 L( x( B: U, P" }( I4 lbackfillfull_ratio 0.9+ M$ ]8 }1 L2 c  Y, ?* _
nearfull_ratio 0.85* m/ I; ?, L$ T& y# F+ S
[root@ceph-2 ~]#

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2022-7-22 11:08:37 | 显示全部楼层
+ x9 ?+ \4 t1 A/ A) V* E
How to set/unset noout:
2 Y. O; a+ Q# e, R; a. t2 z
+ q' _7 ~+ R  g, n) `ceph osd set noout
- \$ V6 P2 o7 F$ s8 ]ceph osd unset noout" j  B- t  b/ {6 o' g- U' Y

0 @& v9 b$ p$ B$ k2 R. N' w- qTo 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.  
8 N. U, n. T9 ]  v: \1 P5 [
+ z/ K4 I" {2 D$ U! t9 ^+ V9 mTo push data away from the osd, run:
' n4 H* c- Z8 _( Q* x8 X3 h+ i/ i- F2 _- ?3 f4 V7 d* _( t
ceph osd reweight $osdID $Weight
. D/ u/ T" s# ^  B* B* M2 z8 ]. C( H+ {/ i( m3 Z4 H, N+ `
Where $osdID is the OSD number "52" and $Weight is a value below 1, for example:3 s$ D0 I, K; w/ S* ^2 c* Z) s
9 z: O5 r* u% Q" P+ e3 M5 Q
ceph osd reweight 52 .85- P4 @) N) F) t" M$ B

+ d$ O& C5 c* i1 d# Q4 [* rThe 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.. u) e% \  l& b% E) \+ f* z" i6 E

4 {2 @# k! l2 `2 ?9 M5 m& W2 v7 bThe 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." d1 J; s5 f0 p' I" X' p2 J
4 i; S8 c- a  i# ], V3 T
Keep 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.
) \& N6 F, p5 `) T. o
* R9 A" O8 m8 ?In some cases it will be necessary to change the following settings temporarily: ( W9 k0 Z+ y# `5 W9 S) L
8 O0 f' d- M% A' X# ]' h: {% K# y
ceph osd set-nearfull-ratio <ratio>
6 R. e7 D5 V7 bceph osd set-backfillfull-ratio <ratio>" \3 o- c, V5 ]6 p4 z1 H
ceph osd set-full-ratio <ratio>4 W0 p0 Z/ G; ^; p  B$ B

2 O) J# h$ Y- N"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.
0 G: L* N# X- o, B0 L1 d  b* \& Y; K, Q+ S: o- w
"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.
% A. n' I3 e7 g  [3 F
6 W! s! M& t3 [: T- @  VIn 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.  6 O7 X4 H- J- c. Y4 ~% B
; j2 _- u2 ]" T7 N# }
Once OSDs are below 95% capacity (full-ratio) or below the 90% capacity (backfillfull-ratio), set the setting sback to default:8 i+ c) }9 \" s/ X* [

; I0 t4 c* g* O1 l! c8 q8 Zceph osd set-nearfull-ratio .85
  y4 g6 g6 N7 o  I: C! Wceph osd set-backfillfull-ratio .90# J, d" N( ~1 U+ x
ceph osd set-full-ratio .95) s( M- b7 e% I( G& J" D5 d7 t
' @/ w; c2 ^% W! \& D
This will ensure that there is breathing room should any OSDs get marked full again at some point in time.  ' d$ o8 }& \1 {! O) ~
- s6 S$ m/ g, W  d- Y; g
If 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:
0 E3 o/ J+ z* G9 {5 E5 r8 ~
5 r# Z3 h# D+ V) z+ W1 I/ e9 }5 nceph osd reweight $osdID $Weight* {' H5 K0 v! S3 v- f  ?# a* D
- z& Z  F/ r/ {- Y
Where $osdID is the OSD number "52" and $Weight is a value up to 1:
. \1 N2 \1 b2 ]& L
; d- N! `% O6 C0 ?/ \ceph osd reweight 52 .90
$ J' Q* c' Y3 w    or
/ m" m# e8 R3 f( D* w1 zceph osd reweight 52 .95$ W6 L$ J" j  M8 `" }0 l
    or
2 M( V1 B6 {2 v8 |/ ~ceph osd reweight 52 1
. ^+ w3 ]+ v* k# R+ m2 a3 k4 r
1 T' x; }8 i4 qMonitor with:, |  [& Y  K9 h* t/ a
4 `& b  J. |+ X6 Q7 m+ x
ceph -s
7 K( E: n% W5 o% _/ ?: T8 eceph health detail$ a1 s1 [3 n' h5 {4 A
ceph osd df tree.  
2 {. G/ G$ t0 f+ ^: G  ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:10 , Processed in 0.019994 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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