본문 바로가기
Tech/Stroage

Ceph PG 계산하기

by 타이호 2017. 12. 22.
반응형

ceph 의 상태가 warning으로 나오는데, ceph status에서 pg가 적다라고 표시된다

ceph -s
cluster 53a8e4b8-521a-42da-8dca-1ae419362868
health HEALTH_WARN
pool default.rgw.meta has many more objects per pg than average (too few pgs?)
pool default.rgw.buckets.data has many more objects per pg than average (too few pgs?)
monmap e1: 3 mons at {juju-machine-1-lxc-16=148.1.6.112:6789/0,juju-machine-2-lxc-3=148.1.6.132:6789/0,juju-machine-3-lxc-2=148.1.6.152:6789/0}
election epoch 48, quorum 0,1,2 juju-machine-1-lxc-16,juju-machine-2-lxc-3,juju-machine-3-lxc-2
osdmap e951: 10 osds: 10 up, 10 in
flags sortbitwise
pgmap v1570584: 17528 pgs, 25 pools, 55828 MB data, 19978 objects
165 GB used, 3170 GB / 3336 GB avail
17528 active+clean

이럴 경우 해당 osd pool의 pg num을 늘려줘야 하는데, 얼마나 늘려줘야 하는지 파악하기 어렵다.

http://ceph.com/pgcalc

pg calc라는 ceph의 공식 페이지도 있지만, 계산을 해야 한다 -_-;;

하지만 역시 누군가가 해결책을 올려놨다.

http://cephnotes.ksperis.com/blog/2015/02/23/get-the-number-of-placement-groups-per-osd

================================================================

ceph pg dump | awk '
/^pg_stat/ { col=1; while($col!="up") {col++}; col++ }
/^[0-9a-f]+\.[0-9a-f]+/ { match($0,/^[0-9a-f]+/); pool=substr($0, RSTART, RLENGTH); poollist[pool]=0;
up=$col; i=0; RSTART=0; RLENGTH=0; delete osds; while(match(up,/[0-9]+/)>0) { osds[++i]=substr(up,RSTART,RLENGTH); up = substr(up, RSTART+RLENGTH) }
for(i in osds) {array[osds[i],pool]++; osdlist[osds[i]];}
}
END {
printf("\n");
printf("pool :\t"); for (i in poollist) printf("%s\t",i); printf("| SUM \n");
for (i in poollist) printf("--------"); printf("----------------\n");
for (i in osdlist) { printf("osd.%i\t", i); sum=0;
for (j in poollist) { printf("%i\t", array[i,j]); sum+=array[i,j]; sumpool[j]+=array[i,j] }; printf("| %i\n",sum) }
for (i in poollist) printf("--------"); printf("----------------\n");
printf("SUM :\t"); for (i in poollist) printf("%s\t",sumpool[i]); printf("|\n");
}'

================================================================

이 결과 해당 OSD가 얼마나 PG를 쓰고 있는지 보여주기 때문에 pg num을 증가 시킬 수 있다

pool : 17 4 18 5 19 6 7 8 9 10 11 20 12 21 22 13 0 23 14 1 24 15 2 16 3| SUM
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
osd.4 2 20 3 17 3 19 16 14 11 18 16 21 17 37 3 20 19 3 26 2284 2 21 2294 1 23 | 4910
osd.5 2 21 2 15 3 23 19 19 14 16 18 23 14 37 2 14 20 2 13 2223 0 20 2303 2 16 | 4841
osd.6 1 11 3 17 1 17 15 14 23 16 22 15 19 32 2 17 24 2 14 2234 4 14 2299 3 19 | 4838
osd.7 0 14 2 25 4 14 15 18 20 18 22 18 15 33 2 20 15 1 12 2285 2 18 2228 3 19 | 4823
osd.8 6 25 3 32 2 21 25 19 29 17 30 26 26 47 0 29 25 3 22 3258 2 27 3275 4 23 | 6976
osd.9 1 20 3 16 3 21 17 19 18 15 18 13 18 41 2 17 17 1 18 2163 0 16 2270 3 17 | 4747
osd.10 2 21 1 12 2 12 21 17 14 23 21 10 21 36 4 19 17 4 25 2270 4 16 2189 0 14 | 4775
osd.0 3 18 2 24 1 16 17 19 22 23 15 16 19 33 2 20 14 3 16 2314 2 16 2272 1 18 | 4906
osd.2 5 15 2 14 2 18 19 19 14 14 11 18 16 41 2 13 19 1 15 2239 4 18 2227 4 17 | 4767
osd.3 2 27 3 20 3 31 28 34 27 32 19 32 27 47 5 23 22 4 31 3306 4 26 3219 3 26 | 7001
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SUM : 24 192 24 192 24 192 192 192 192 192 192 192 192 384 24 192 192 24 192 24576 24 192 24576 24 192 |

반응형