Ceph

[Ceph] get/edit/set crushmap 수정/설정/적용

plastic2113 2025. 5. 20. 10:31
728x90
반응형

# get crushmap.

현재 적용되어있는 crushmap의 컴파일 된 설정을 뽑는다.

root@mon0:~# ceph osd getcrushmap -o [COMPILED_FILE]

# edit.

컴파일 되어있는 [COMPILED_FILE][CRUSHMAP.TXT]로 변환.

root@mon0:~# crushtool -d [COMPILED_FILE] -o [CRUSHMAP.TXT]
반응형

vi로 [CRUSHMAP.TXT] 수정

# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable chooseleaf_stable 1
tunable straw_calc_version 1
tunable allowed_bucket_algs 54

# devices
device 0 osd.0 class hdd
...

# types
type 0 osd
type 1 [OSD-A]
type 3 [A-group]
...

# buckets
[OSD-A] A-bucket {
	id -3	 # do not change unnecessarily
    id -4 class hdd	# do not change unnecessarily
    alg straw2
    hash 0  # rjenkins1
    item osd.0 weight 0
    ...
}

# rules
rule [A] {
	id 0
    type replicated
    step take [root-A]
    step choose firstn 2 type [A-group]
    step chooseleaf firstn 2 type [OSD-A]
    step emit
}
728x90

# set crushmap.

수정된 [CRUSHMAP.TXT] 컴파일.

root@mon0:~# crushtool -c [CRUSHMAP.TXT] -o [NEW_COMPILED]

 

컴파일된 [NEW_COMPILED] 로 crushmap 적용.

root@mon0:~# ceph osd setcrushmap -i [NEW_COMPILED]

 

 

 

# verifying.

crush map이 적용된 osd 구조 확인.

root@mon0:~# ceph osd tree

 

 

728x90
반응형