4.3. 데몬의 CRUSH 위치 설정
확장 모드로 전환하기 전에 CRUSH 위치를 Red Hat Ceph Storage 클러스터의 데몬으로 설정하여 클러스터를 준비해야 합니다. 이 작업을 수행하는 방법은 다음 두 가지가 있습니다.
- 배포의 일부로 위치가 호스트에 추가되는 서비스 구성 파일을 통해 클러스터를 부트스트랩합니다.
-
클러스터가 배포된 후
ceph osd crush add-bucket및ceph osd crush move명령을 통해 수동으로 위치를 설정합니다.
방법 1: 클러스터 부팅
사전 요구 사항
- 노드에 대한 루트 수준 액세스.
프로세스
새 스토리지 클러스터를 부트 스트랩하는 경우 노드를 Red Hat Ceph Storage 클러스터에 추가하는 서비스 구성
.yaml파일을 생성하고 서비스가 실행되어야 하는 위치에 대한 특정 레이블을 설정할 수 있습니다.예
service_type: host addr: host01 hostname: host01 location: root: default datacenter: DC1 labels: - osd - mon - mgr --- service_type: host addr: host02 hostname: host02 location: datacenter: DC1 labels: - osd - mon --- service_type: host addr: host03 hostname: host03 location: datacenter: DC1 labels: - osd - mds - rgw --- service_type: host addr: host04 hostname: host04 location: root: default datacenter: DC2 labels: - osd - mon - mgr --- service_type: host addr: host05 hostname: host05 location: datacenter: DC2 labels: - osd - mon --- service_type: host addr: host06 hostname: host06 location: datacenter: DC2 labels: - osd - mds - rgw --- service_type: host addr: host07 hostname: host07 labels: - mon --- service_type: mon placement: label: "mon" --- service_id: cephfs placement: label: "mds" --- service_type: mgr service_name: mgr placement: label: "mgr" --- service_type: osd service_id: all-available-devices service_name: osd.all-available-devices placement: label: "osd" spec: data_devices: all: true --- service_type: rgw service_id: objectgw service_name: rgw.objectgw placement: count: 2 label: "rgw" spec: rgw_frontend_port: 8080--apply-spec옵션을 사용하여 스토리지 클러스터를 부트스트랩합니다.구문
cephadm bootstrap --apply-spec CONFIGURATION_FILE_NAME --mon-ip MONITOR_IP_ADDRESS --ssh-private-key PRIVATE_KEY --ssh-public-key PUBLIC_KEY --registry-url REGISTRY_URL --registry-username USER_NAME --registry-password PASSWORD예
[root@host01 ~]# cephadm bootstrap --apply-spec initial-config.yaml --mon-ip 10.10.128.68 --ssh-private-key /home/ceph/.ssh/id_rsa --ssh-public-key /home/ceph/.ssh/id_rsa.pub --registry-url registry.redhat.io --registry-username myuser1 --registry-password mypassword1중요cephadm bootstrap명령과 함께 다양한 명령 옵션을 사용할 수 있습니다. 그러나 서비스 구성 파일을 사용하고 호스트 위치를 구성하려면 항상--apply-spec옵션을 포함합니다.
방법 2: 배포 후 위치 설정
사전 요구 사항
- 노드에 대한 루트 수준 액세스.
프로세스
tiebreaker 모니터의 위치를 CRUSH 맵에 설정하려는 두 개의 버킷을 CRUSH 맵으로 추가하여 버킷 유형을
데이터센터로 지정합니다.구문
ceph osd crush add-bucket BUCKET_NAME BUCKET_TYPE예
[ceph: root@host01 /]# ceph osd crush add-bucket DC1 datacenter [ceph: root@host01 /]# ceph osd crush add-bucket DC2 datacenterroot=default아래의 버킷을 이동합니다.구문
ceph osd crush move BUCKET_NAME root=default예
[ceph: root@host01 /]# ceph osd crush move DC1 root=default [ceph: root@host01 /]# ceph osd crush move DC2 root=default필요한 CRUSH 배치에 따라 OSD 호스트를 이동합니다.
구문
ceph osd crush move HOST datacenter=DATACENTER예
[ceph: root@host01 /]# ceph osd crush move host01 datacenter=DC1
4.3.1. 스트레치 모드 입력 링크 복사링크가 클립보드에 복사되었습니다!
새로운 스트레치 모드는 두 개의 사이트를 처리하도록 설계되었습니다. 2개 사이트 클러스터에서 구성 요소 가용성 중단의 위험이 줄어 듭니다.
사전 요구 사항
- 노드에 대한 루트 수준 액세스.
- CRUSH 위치는 호스트로 설정됩니다.
프로세스
CRUSH 맵과 일치하는 각 모니터의 위치를 설정합니다.
구문
ceph mon set_location HOST datacenter=DATACENTER예
[ceph: root@host01 /]# ceph mon set_location host01 datacenter=DC1 [ceph: root@host01 /]# ceph mon set_location host02 datacenter=DC1 [ceph: root@host01 /]# ceph mon set_location host04 datacenter=DC2 [ceph: root@host01 /]# ceph mon set_location host05 datacenter=DC2 [ceph: root@host01 /]# ceph mon set_location host07 datacenter=DC3각 데이터 센터에 두 개의 복사본을 배치하는 CRUSH 규칙을 생성합니다.
구문
ceph osd getcrushmap > COMPILED_CRUSHMAP_FILENAME crushtool -d COMPILED_CRUSHMAP_FILENAME -o DECOMPILED_CRUSHMAP_FILENAME예
[ceph: root@host01 /]# ceph osd getcrushmap > crush.map.bin [ceph: root@host01 /]# crushtool -d crush.map.bin -o crush.map.txt해제된 CRUSH 맵 파일을 편집하여 새 규칙을 추가합니다.
예
rule stretch_rule { id 11 type replicated min_size 1 max_size 10 step take DC12 step chooseleaf firstn 2 type host step emit step take DC23 step chooseleaf firstn 2 type host step emit }참고이 규칙은 클러스터에 데이터 센터
DC1에 대한 읽기 방지를 제공합니다. 따라서 모든 읽기 또는 쓰기는DC1에 배치된 Ceph OSD를 통해 수행됩니다.이 방법이 바람직하지 않고 읽기 또는 쓰기를 영역에 균등하게 분산하는 경우 CRUSH 규칙은 다음과 같습니다.
예
rule stretch_rule { id 1 type replicated min_size 1 max_size 10 step take default step choose firstn 0 type datacenter step chooseleaf firstn 2 type host step emit }이 규칙에서는 데이터 센터가 임의로 자동으로 선택됩니다.
firstn및indep옵션에 대한 자세한 내용은 CRUSH 규칙을 참조하십시오.
CRUSH 맵을 삽입하여 클러스터에서 규칙을 사용할 수 있도록 합니다.
구문
crushtool -c DECOMPILED_CRUSHMAP_FILENAME -o COMPILED_CRUSHMAP_FILENAME ceph osd setcrushmap -i COMPILED_CRUSHMAP_FILENAME예
[ceph: root@host01 /]# crushtool -c crush.map.txt -o crush2.map.bin [ceph: root@host01 /]# ceph osd setcrushmap -i crush2.map.bin연결 모드에서 모니터를 실행하지 않으면 선택 전략을
connectivity로 설정합니다.예
[ceph: root@host01 /]# ceph mon set election_strategy connectivity데이터 센터 간에 분할되도록 연결 장치 모니터의 위치를 설정하여 스트레치 모드로 전환합니다.
구문
ceph mon set_location HOST datacenter=DATACENTER ceph mon enable_stretch_mode HOST stretch_rule datacenter예
[ceph: root@host01 /]# ceph mon set_location host07 datacenter=DC3 [ceph: root@host01 /]# ceph mon enable_stretch_mode host07 stretch_rule datacenter이 예에서 모니터
mon.host07은 타이블러입니다.중요tiebreaker 모니터의 위치는 이전에 비대신 모니터를 설정한 데이터 센터와 달라야 합니다. 위의 예에서 데이터 센터
DC3입니다.중요이 데이터 센터를 CRUSH 맵에 추가하지 마십시오. 이 데이터 센터를 스트레치 모드로 전환하려고 할 때 다음과 같은 오류가 발생합니다.
Error EINVAL: there are 3 datacenters in the cluster but stretch mode currently only works with 2!참고Ceph 배포를 위해 자체 툴링을 작성하는 경우
ceph mon set_location명령을 실행하는 대신 모니터를 부팅할 때 새로운--set-crush-location옵션을 사용할 수 있습니다. 이 옵션은enable_stretch_mode명령을 실행할 때 지정한 버킷 유형과 일치해야 하는ceph-mon --set-crush-location 'datacenter=DC1'과 같은 단일bucket=location쌍만 허용합니다.스트레치 모드가 성공적으로 활성화되었는지 확인합니다.
예
[ceph: root@host01 /]# ceph osd dump epoch 361 fsid 1234ab78-1234-11ed-b1b1-de456ef0a89d created 2023-01-16T05:47:28.482717+0000 modified 2023-01-17T17:36:50.066183+0000 flags sortbitwise,recovery_deletes,purged_snapdirs,pglog_hardlimit crush_version 31 full_ratio 0.95 backfillfull_ratio 0.92 nearfull_ratio 0.85 require_min_compat_client luminous min_compat_client luminous require_osd_release quincy stretch_mode_enabled true stretch_bucket_count 2 degraded_stretch_mode 0 recovering_stretch_mode 0 stretch_mode_bucket 8stretch_mode_enabled를true로 설정해야 합니다. 스트레치 버킷 수, 스트레치 모드 버킷, 스트레치 모드의 성능이 저하되거나 복구되는 경우에도 볼 수 있습니다.모니터가 적절한 위치에 있는지 확인합니다.
예
[ceph: root@host01 /]# ceph mon dump epoch 19 fsid 1234ab78-1234-11ed-b1b1-de456ef0a89d last_changed 2023-01-17T04:12:05.709475+0000 created 2023-01-16T05:47:25.631684+0000 min_mon_release 16 (pacific) election_strategy: 3 stretch_mode_enabled 1 tiebreaker_mon host07 disallowed_leaders host07 0: [v2:132.224.169.63:3300/0,v1:132.224.169.63:6789/0] mon.host07; crush_location {datacenter=DC3} 1: [v2:220.141.179.34:3300/0,v1:220.141.179.34:6789/0] mon.host04; crush_location {datacenter=DC2} 2: [v2:40.90.220.224:3300/0,v1:40.90.220.224:6789/0] mon.host01; crush_location {datacenter=DC1} 3: [v2:60.140.141.144:3300/0,v1:60.140.141.144:6789/0] mon.host02; crush_location {datacenter=DC1} 4: [v2:186.184.61.92:3300/0,v1:186.184.61.92:6789/0] mon.host05; crush_location {datacenter=DC2} dumped monmap epoch 19또한 어떤 모니터가 묶인 모니터와 모니터 선택 전략을 확인할 수 있습니다.
4.3.2. 스트레치 모드에 대한 CRUSH 맵 구성 링크 복사링크가 클립보드에 복사되었습니다!
이 정보를 사용하여 스트레치 모드에 대한 CRUSH 맵을 구성합니다.
사전 요구 사항
시작하기 전에 다음 사전 요구 사항이 있는지 확인하십시오.
- 노드에 대한 루트 수준 액세스.
- CRUSH 위치는 호스트로 설정됩니다.
프로세스
crushtool명령을 사용하기 위해 ceph-base RPM 패키지를 설치하여 이 OSD crush 토폴로지를 사용하는 CRUSH 규칙을 만듭니다.구문
dnf -y install ceph-base클러스터에서 컴파일된 CRUSH 맵을 가져옵니다.
구문
ceph osd getcrushmap > /etc/ceph/crushmap.binCRUSH 맵을 컴파일하고 텍스트 파일로 변환하여 편집합니다.
구문
crushtool -d /etc/ceph/crushmap.bin -o /etc/ceph/crushmap.txt파일 끝에
/etc/ceph/crushmap.txt를 편집하여 CRUSH 맵에 다음 규칙을 추가합니다. 이 규칙은 데이터 센터에 읽기 및 쓰기를 균등하게 분배합니다.구문
rule stretch_rule { id 1 type replicated step take default step choose firstn 0 type datacenter step chooseleaf firstn 2 type host step emit }선택적으로 데이터 센터 1에 대한 읽기/쓰기 선호도가 있는 클러스터가 있어야 합니다.
구문
rule stretch_rule { id 1 type replicated step take DC1 step chooseleaf firstn 2 type host step emit step take DC2 step chooseleaf firstn 2 type host step emit }The CRUSH rule declared contains the following information: Rule name Description: A unique name for identifying the rule. Value: stretch_rule id Description: A unique whole number for identifying the rule. Value: 1 type Description: Describes a rule for either a storage drive replicated or erasure-coded. Value: replicated step take default Description: Takes the root bucket called default, and begins iterating down the tree. step take DC1 Description: Takes the bucket called DC1, and begins iterating down the tree. step choose firstn 0 type datacenter Description: Selects the datacenter bucket, and goes into its subtrees. step chooseleaf firstn 2 type host Description: Selects the number of buckets of the given type. In this case, it is two different hosts located in the datacenter it entered at the previous level. step emit Description: Outputs the current value and empties the stack. Typically used at the end of a rule, but may also be used to pick from different trees in the same rule.
/etc/ceph/crushmap.txt에서 새 CRUSH 맵을 컴파일하고 바이너리 파일/etc/ceph/crushmap2.bin로 변환합니다.구문
crushtool -c /path/to/crushmap.txt -o /path/to/crushmap2.bin예
[ceph: root@host01 /]# crushtool -c /etc/ceph/crushmap.txt -o /etc/ceph/crushmap2.bin새로 생성된 CRUSH 맵을 클러스터에 다시 삽입합니다.
구문
ceph osd setcrushmap -i /path/to/compiled_crushmap예
[ceph: root@host01 /]# ceph osd setcrushmap -i /path/to/compiled_crushmap 17참고숫자 17은 CRUSH 맵에 적용된 변경 사항에 따라 카운터 및 증가(18,19)입니다.
확인
새로 생성된 stretch_rule 을 사용할 수 있는지 확인합니다.
구문
ceph osd crush rule ls
예
[ceph: root@host01 /]# ceph osd crush rule ls
replicated_rule
stretch_rule
4.3.2.1. 스트레치 모드 입력 링크 복사링크가 클립보드에 복사되었습니다!
스트레치 모드는 두 개의 사이트를 처리하도록 설계되었습니다. 2개의 사이트 클러스터에서 구성 요소 가용성 중단의 위험이 줄어 듭니다.
사전 요구 사항
시작하기 전에 다음 사전 요구 사항이 있는지 확인하십시오.
- 노드에 대한 루트 수준 액세스.
- CRUSH 위치는 호스트로 설정됩니다.
- 스트레치 규칙을 포함하도록 구성된 CRUSH 맵입니다.
- 클러스터에 코딩된 풀 삭제가 없습니다.
- 두 사이트의 가중치는 동일합니다.
프로세스
모니터에서 현재 사용 중인 선택 전략을 확인합니다.
구문
ceph mon dump | grep election_strategy참고Ceph 클러스터
election_strategy는 기본적으로1로 설정됩니다.예
[ceph: root@host01 /]# ceph mon dump | grep election_strategy dumped monmap epoch 9 election_strategy: 1선택 전략을
연결로변경합니다.구문
ceph mon set election_strategy connectivity선택 전략 구성에 대한 자세한 내용은 모니터 선택 전략 구성을 참조하십시오.
ceph mon dump명령을 사용하여 선택 전략이3으로 업데이트되었는지 확인합니다.예
[ceph: root@host01 /]# ceph mon dump | grep election_strategy dumped monmap epoch 22 election_strategy: 3데이터 센터 간에 분할되도록 묶은 모니터의 위치를 설정합니다.
구문
ceph mon set_location TIEBREAKER_HOST datacenter=DC3예
[ceph: root@host01 /]# ceph mon set_location host07 datacenter=DC3tiebreaker 모니터가 예상대로 설정되었는지 확인합니다.
구문
ceph mon dump예
[ceph: root@host01 /]# ceph mon dump epoch 8 fsid 4158287e-169e-11f0-b1ad-fa163e98b991 last_changed 2025-04-11T07:14:48.652801+0000 created 2025-04-11T06:29:24.974553+0000 min_mon_release 19 (squid) election_strategy: 3 0: [v2:10.0.57.33:3300/0,v1:10.0.57.33:6789/0] mon.host07; crush_location {datacenter=DC3} 1: [v2:10.0.58.200:3300/0,v1:10.0.58.200:6789/0] mon.host05; crush_location {datacenter=DC2} 2: [v2:10.0.58.47:3300/0,v1:10.0.58.47:6789/0] mon.host02; crush_location {datacenter=DC1} 3: [v2:10.0.58.104:3300/0,v1:10.0.58.104:6789/0] mon.host04; crush_location {datacenter=DC2} 4: [v2:10.0.58.38:3300/0,v1:10.0.58.38:6789/0] mon.host01; crush_location {datacenter=DC1} dumped monmap epoch 8 0스트레치 모드로 들어갑니다.
구문
ceph mon enable_stretch_mode TIEBREAKER_HOST STRETCH_RULE STRETCH_BUCKET다음 예제에서는 다음을 수행합니다.
- tiebreaker 노드는 host07로 설정됩니다.
- 스트레치 규칙은 에 생성된 대로 stretch_rule입니다.
- 확장 버킷은 데이터 센터로 설정됩니다.
[ceph: root@host01 /]# ceph mon enable_stretch_mode host07 stretch_rule datacenter
확인
CROSREF를 계속 진행하여 스트레치 모드가 올바르게 구현되었는지 확인합니다.
4.3.2.2. 스트레치 모드 확인 링크 복사링크가 클립보드에 복사되었습니다!
이 정보를 사용하여 구현된 CRUSH 규칙으로 스트레치 모드가 올바르게 생성되었는지 확인합니다.
프로세스
모든 풀이 Ceph 클러스터에서 생성된 CRUSH 규칙을 사용하고 있는지 확인합니다. 이 예제에서 CRUSH 규칙은 스트레치 모드의 CRUSH 맵 구성에서 생성된 설정에 따라
stretch_rule 로 설정됩니다.구문
for pool in $(rados lspools);do echo -n "Pool: ${pool}; ";ceph osd pool get ${pool} crush_rule;done예
[ceph: root@host01 /]# for pool in $(rados lspools);do echo -n "Pool: ${pool}; ";ceph osd pool get ${pool} crush_rule;done Pool: device_health_metrics; crush_rule: stretch_rule Pool: cephfs.cephfs.meta; crush_rule: stretch_rule Pool: cephfs.cephfs.data; crush_rule: stretch_rule Pool: .rgw.root; crush_rule: stretch_rule Pool: default.rgw.log; crush_rule: stretch_rule Pool: default.rgw.control; crush_rule: stretch_rule Pool: default.rgw.meta; crush_rule: stretch_rule Pool: rbdpool; crush_rule: stretch_rule스트레치 모드가 활성화되었는지 확인합니다.
stretch_mode_enabled가true로 설정되어 있는지 확인합니다.구문
ceph osd dump출력에는 다음 정보가 포함됩니다.
- stretch_mode_enabled
-
스트레치 모드가 활성화된 경우
true로 설정합니다. - stretch_bucket_count
- OSD가 있는 데이터 센터 수입니다.
- degraded_stretch_mode
-
성능이 저하되지 않은 경우
0의 출력입니다. 스트레치 모드의 성능이 저하되면 사이트 수가 출력됩니다. - recovering_stretch_mode
-
복구하지 않는 경우
0의 출력입니다. 스트레치 모드가 복구되는 경우 출력은1입니다. - stretch_mode_bucket
각 CRUSH 버킷 유형에 대해 설정된 고유한 값입니다. 이 값은 일반적으로 데이터 센터의 경우
8로 설정됩니다.예
"stretch_mode": { "stretch_mode_enabled": true, "stretch_bucket_count": 2, "degraded_stretch_mode": 0, "recovering_stretch_mode": 1, "stretch_mode_bucket": 8
ceph mon dump를 사용하여 mon 맵을 사용하고 있는지 확인합니다.다음을 확인하십시오.
-
stretch_mode_enabled가1로 설정 -
올바른 mon 호스트가
tiebreaker_mon으로 설정됨 올바른 mon 호스트가
disallowed_leaders로 설정됩니다.구문
ceph mon dump예
[ceph: root@host01 /]# ceph mon dump epoch 16 fsid ff19789c-f5c7-11ef-8e1c-fa163e4e1f7e last_changed 2025-02-28T12:12:51.089706+0000 created 2025-02-28T11:34:59.325503+0000 min_mon_release 19 (squid) election_strategy: 3 stretch_mode_enabled 1 tiebreaker_mon host07 disallowed_leaders host07 0: [v2:10.0.56.37:3300/0,v1:10.0.56.37:6789/0] mon.host01; crush_location {datacenter=DC1} 1: [v2:10.0.59.188:3300/0,v1:10.0.59.188:6789/0] mon.host05; crush_location {datacenter=DC2} 2: [v2:10.0.59.35:3300/0,v1:10.0.59.35:6789/0] mon.host02; crush_location {datacenter=DC1} 3: [v2:10.0.56.189:3300/0,v1:10.0.56.189:6789/0] mon.host07; crush_location {datacenter=DC3} 4: [v2:10.0.56.13:3300/0,v1:10.0.56.13:6789/0] mon.host04; crush_location {datacenter=DC2} dumped monmap epoch 16
-
다음에 수행할 작업
- Ceph Object Gateway를 배포, 구성 및 관리합니다. 자세한 내용은 Ceph Object Gateway 를 참조하십시오.
- Ceph 블록 장치를 관리, 생성, 구성 및 사용합니다. 자세한 내용은 Ceph 블록 장치를 참조하십시오.
- Ceph 파일 시스템(CephFS)을 생성, 마운트 및 작업합니다. 자세한 내용은 Ceph 파일 시스템을 참조하십시오.