[Ceph] Storage Cluster 초기화 방법

2024. 3. 10. 16:06·🔹Storage
728x90
SMALL

 

ceph version : 17.2.6

 

1. OSD 삭제

# osd 상태 확인 명령어
ceph osd status
ceph orch ps --daemon_type osd --refresh

# Alias 설정

TARGET_OSD_ID="0" 
#EXAMPLE (ceph osd status 에서 ID 값 입력)

TARGET_HOST_NAME=$(ceph orch ps --daemon_type osd --format json| jq -r '.[] | select(.daemon_id == '\""$TARGET_OSD_ID"\"') | .hostname')

TARGET_DAEMON_NAME=$(ceph orch ps --daemon_type osd --format json | jq -r '.[] | select(.daemon_id == '\""$TARGET_OSD_ID"\"') | .daemon_name')

TARGET_OSD_DEV_PATH=$(ceph device ls-by-host "${TARGET_HOST_NAME}" --format json | jq -r '.[] | select(.daemons[] | contains('\""${TARGET_DAEMON_NAME}"\"')) | .location[] | .dev')

SERVICE_NAME=$(ceph orch ls --service_type osd --format json | jq -c '.[] | select(.spec.data_devices.paths != null) | select(.spec.data_devices.paths[] | contains('\""${TARGET_OSD_DEV_PATH}"\"')) | select(.placement.hosts != null) | select(.placement.hosts[] | contains('\""${TARGET_HOST_NAME}"\"'))' | jq -r '.service_name')

# Alias 확인

echo $TARGET_HOST_NAME        
echo $TARGET_OSD_DEV_PATH  
echo $TARGET_DAEMON_NAME
echo $SERVICE_NAME

# osd 완전 삭제

ceph orch rm "${SERVICE_NAME}" --force
sleep 15
ceph osd down "$TARGET_OSD_ID"
sleep 15
ceph osd purge "$TARGET_OSD_ID" --force --yes-i-really-mean-it
sleep 15
ceph orch daemon rm "${TARGET_DAEMON_NAME}" --force

 

모든 osd 를 삭제한 뒤, 다음 단계인 Host 삭제 진행

 

2. Host 삭제

# Host 상태 확인 명령어
ceph orch host ls

# Alias 설정
HOST="node3" #EXAMPLE

# Host 삭제

ceph orch host drain ${HOST}          # Drain 이 모두 정상적으로 될 때까지 기다리는 것이 좋습니다. (약 30초 정도?)
sleep 60
ceph orch host rm ${HOST} --force

 

다만, admin label 이 있는 Host 삭제 시에는,

drain 부분에서 force 명령어를 붙이셔야 합니다

 

3. Ceph Cluster 자체 삭제

$ cephadm rm-cluster --fsid $(cephadm ls | jq -r '.[0].fsid') --force
$ cephadm ls
[]

 

4. 잔해물 제거

# 설정 파일 삭제

rm -rf /etc/ceph
rm -rf /var/lib/ceph*
rm -rf /etc/systemd/system/ceph* # Service files

# osd 가 깔려있던 disk 포맷

ls /dev/mapper/ceph-* | xargs -I% -- dmsetup remove %
rm -rf /dev/ceph-*
LIST

'🔹Storage' 카테고리의 다른 글

[Ceph 18.2.0] Rocky 9.4 version 설치  (1) 2024.07.25
stress 명령어 사용법  (0) 2024.03.25
RADOS Object 레벨 스토리지 명령어  (0) 2024.03.10
[Ceph] RADOS Block Device 명령어  (0) 2024.03.10
Ceph 상태 확인 명령어  (0) 2024.03.10
'🔹Storage' 카테고리의 다른 글
  • stress 명령어 사용법
  • RADOS Object 레벨 스토리지 명령어
  • [Ceph] RADOS Block Device 명령어
  • Ceph 상태 확인 명령어
terranbin
terranbin
Studying Computer Science
  • terranbin
    Engineer
    terranbin
  • 전체
    오늘
    어제
    • 분류 전체보기 (129)
      • ☁️Cloud (42)
        • AWS (38)
        • MS Azure (4)
      • 🐳 Infra (1)
        • System (12)
        • DRBD (3)
      • 🔌Network (8)
      • 🔹Storage (8)
      • 🔹Kubernetes (15)
      • 🔹 DevOps (8)
      • 🔹Study (4)
      • 🔹Install (6)
      • 🔹ETC (2)
      • 🔹PostMan (6)
      • 🔹Openstack (3)
      • 🔹RcloneView (6)
      • 🔹Test (0)
      • 🔹Debug (2)
      • 🔹DBMS (2)
  • 블로그 메뉴

    • 홈
  • 링크

    • sungbin
    • Github
  • 공지사항

  • 인기 글

  • 태그

    OpenStack
    ceph
    postman
    kubectl
    rocky9
    설치
    S3
    centos7
    aws dlt
    network
    EC2
    terraform
    rcloneview
    Google Drive
    kubernetes
    distributed load testing
    SAA
    AWS
    EBS
    rocky8
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
terranbin
[Ceph] Storage Cluster 초기화 방법
상단으로

티스토리툴바