4.7. 베어 메탈 배포용 Ceph Monitor 복구


Red Hat Ceph Storage 클러스터에 모든 모니터가 다운되고 ceph -s 명령이 예상대로 실행되지 않으면 monmaptool 명령을 사용하여 모니터를 복구할 수 있습니다. monmaptool 명령은 데몬의 인증 키 파일에서 Ceph 모니터 저장소를 다시 빌드합니다.

참고

이 절차는 베어 메탈 Red Hat Ceph Storage 배포 전용입니다. 컨테이너화된 Red Hat Ceph Storage 배포의 경우 3mon이 모두 중단된 경우 Red Hat Ceph Storage 컨테이너화된 배포의 Knowledgebase 문서 MON 복구 절차를 참조하십시오.

사전 요구 사항

  • 베어 메탈 배포 Red Hat Ceph Storage 클러스터.
  • 모든 노드에 대한 루트 수준 액세스입니다.
  • 모든 Ceph 모니터가 다운되었습니다.

절차

  1. 모니터 노드에 로그인합니다.
  2. 모니터 노드에서 root 사용자가 없는 OSD 노드에 액세스할 수 없는 경우 공개 키 쌍을 OSD 노드에 복사합니다.

    1. SSH 키 쌍을 생성하고 기본 파일 이름을 사용하고 암호를 비워 둡니다.

      예제

      [root@mons-1 ~]# ssh-keygen
      Copy to Clipboard

    2. 공개 키를 스토리지 클러스터의 모든 OSD 노드에 복사합니다.

      예제

      [root@mons-1 ~]#  ssh-copy-id root@osds-1
      [root@mons-1 ~]#  ssh-copy-id root@osds-2
      [root@mons-1 ~]#  ssh-copy-id root@osds-3
      Copy to Clipboard

  3. 모든 OSD 노드에서 OSD 데몬 서비스를 중지합니다.

    예제

    [root@osds-1 ~]#  sudo systemctl stop ceph-osd\*.service ceph-osd.target
    Copy to Clipboard

  4. 모든 OSD 노드에서 클러스터 맵을 수집하려면 복구 파일을 생성하고 스크립트를 실행합니다.

    1. 복구 파일을 생성합니다.

      예제

      [root@mons-1 ~]# touch recover.sh
      Copy to Clipboard

    2. 다음 콘텐츠를 파일에 추가하고 OSD_NODES 를 모든 OSD 노드의 IP 주소 또는 Red Hat Ceph Storage 클러스터에 있는 모든 OSD 노드의 호스트 이름으로 교체합니다.

      구문

       --------------------------------------------------------------------------  NOTE: The directory names specified by 'ms', 'db', and 'db_slow' must end
       with a trailing / otherwise rsync will not operate properly.  --------------------------------------------------------------------------
      ms=/tmp/monstore/
      db=/root/db/
      db_slow=/root/db.slow/
      
      mkdir -p $ms $db $db_slow
      
       --------------------------------------------------------------------------  NOTE: Replace the contents inside double quotes for 'osd_nodes' below with
       the list of OSD nodes in the environment.  --------------------------------------------------------------------------
      osd_nodes="OSD_NODES_1 OSD_NODES_2 OSD_NODES_3..."
      
      for osd_node in $osd_nodes; do
      echo "Operating on $osd_node"
      rsync -avz --delete $ms $osd_node:$ms
      rsync -avz --delete $db $osd_node:$db
      rsync -avz --delete $db_slow $osd_node:$db_slow
      
      ssh -t $osd_node <<EOF
      for osd in /var/lib/ceph/osd/ceph-*; do
          ceph-objectstore-tool --type bluestore --data-path \$osd --op update-mon-db --no-mon-config --mon-store-path $ms
          if [ -e \$osd/keyring ]; then
              cat \$osd/keyring >> $ms/keyring
              echo '    caps mgr = "allow profile osd"' >> $ms/keyring
              echo '    caps mon = "allow profile osd"' >> $ms/keyring
              echo '    caps osd = "allow *"' >> $ms/keyring
          else
              echo WARNING: \$osd on $osd_node does not have a local keyring.
          fi
      done
      EOF
      
      rsync -avz --delete --remove-source-files $osd_node:$ms $ms
      rsync -avz --delete --remove-source-files $osd_node:$db $db
      rsync -avz --delete --remove-source-files $osd_node:$db_slow $db_slow
      done
       --------------------------------------------------------------------------  End of script
      ## --------------------------------------------------------------------------
      Copy to Clipboard

    3. 파일에 실행 가능한 권한을 제공합니다.

      예제

      [root@mons-1 ~]# chmod 755 recover.sh
      Copy to Clipboard

    4. 파일을 실행하여 스토리지 클러스터의 모든 OSD 노드에서 모든 OSD의 인증 키를 수집합니다.

      예제

      [root@mons-1 ~]# ./recovery.sh
      Copy to Clipboard

  5. 해당 노드에서 다른 데몬의 인증 키를 가져옵니다.

    1. Ceph Monitor의 경우 인증 키는 모든 Ceph 모니터에 대해 동일합니다.

      구문

      cat /var/lib/ceph/mon/ceph-MONITOR_NODE/keyring
      Copy to Clipboard

      예제

      [root@mons-1 ~]# cat /var/lib/ceph/mon/ceph-mons-1/keyring
      Copy to Clipboard

    2. Ceph Manager의 경우 모든 관리자 노드에서 인증 키를 가져옵니다.

      구문

      cat /var/lib/ceph/mgr/ceph-MANAGER_NODE/keyring
      Copy to Clipboard

      예제

      [root@mons-1 ~]# cat /var/lib/ceph/mgr/ceph-mons-1/keyring
      Copy to Clipboard

    3. Ceph OSD의 경우 인증 키는 위의 스크립트에서 생성되어 임시 경로에 저장됩니다.

      이 예에서는 OSD 키링이 /tmp/monstore/keyring 파일에 저장됩니다.

    4. 클라이언트의 모든 클라이언트 노드에서 인증 키를 가져옵니다.

      구문

      cat /etc/ceph/CLIENT_KEYRING
      Copy to Clipboard

      예제

      [root@client ~]# cat /etc/ceph/ceph.client.admin.keyring
      Copy to Clipboard

    5. 메타 데이터 서버(MDS)의 경우 모든 Ceph MDS 노드에서 인증 키를 가져옵니다.

      구문

      cat /var/lib/ceph/mds/ceph-MDS_NODE/keyring
      Copy to Clipboard

      예제

      [root@mons-2 ~]# cat /var/lib/ceph/mds/ceph-mds-1/keyring
      Copy to Clipboard

      이 키 링의 경우 다음과 같은 기능을 추가합니다.

      caps mds =  "allow"
      caps mon = "allow profile mds"
      caps osd = "allow *"
      Copy to Clipboard
    6. Ceph Object Gateway의 경우 모든 Ceph Object Gateway 노드에서 인증 키를 가져옵니다.

      구문

      cat /var/lib/ceph/radosgw/ceph-CEPH_OBJECT_GATEWAY_NODE/keyring
      Copy to Clipboard

      예제

      [root@mons-3 ~]# cat /var/lib/ceph/radosgw/ceph-rgw-1/keyring
      Copy to Clipboard

      이 키 링의 경우 다음과 같은 기능을 추가합니다.

      caps mon = "allow rw"
      caps osd = "allow *"
      Copy to Clipboard
  6. Ansible 관리 노드에서 이전 단계에서 가져온 모든 인증 키를 사용하여 파일을 생성합니다.

    예제

    [root@admin ~]# cat /tmp/monstore/keyring
    
    [mon.]
    	key = AQAa+RxhAAAAABAApmwud0GQHX0raMBc9zTAYQ==
    	caps mon = "allow *"
    [client.admin]
    	key = AQAo+RxhcYWtGBAAiY4kKltMGnAXqPLM2A+B8w==
    	caps mds = "allow *"
    	caps mgr = "allow *"
    	caps mon = "allow *"
    	caps osd = "allow *"
    [mgr.mons-1]
    	key = AQA++RxhAAAAABAAKdG1ETTEMR8KPa9ZpfcIzw==
    	caps mds = "allow *"
    	caps mon = "allow profile mgr"
    	caps osd = "allow *"
    [mgr.mons-2]
    	key = AQA9+RxhAAAAABAAcCBxsoaIl0sdHTz3dqX4SQ==
    	caps mds = "allow *"
    	caps mon = "allow profile mgr"
    	caps osd = "allow *"
    [mgr.mons-3]
    	key = AQA/+RxhAAAAABAAwe/mwv0hS79fWP+00W6ypQ==
    	caps mds = "allow *"
    	caps mon = "allow profile mgr"
    	caps osd = "allow *"
    [osd.1]
    key = AQB/+RxhlH8rFxAAL3mb8Kdb+QuWWdJi+RvwGw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.5]
    key = AQCE+RxhKSNsHRAAIyLO5g75tqFVsl6MEEzwXw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.8]
    key = AQCJ+Rxhc0wHJhAA5Bb2kU9Nadpm3UCLASnCfw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.2]
    key = AQB/+RxhhrQCGRAAUhh77gIVhN8zsTbaKMJuHw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.4]
    key = AQCE+Rxh0mDxDRAApAeqKOJycW5bpP3IuAhSMw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.7]
    key = AQCJ+Rxhn+RAIhAAp1ImK1jiazBsDpmTQvVEVw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.0]
    key = AQB/+RxhPhh+FRAAc5b0nwiuK6o1AIbjVc6tQg==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.3]
    key = AQCE+RxhJv8PARAAqCzH2br1xJmMTNnqH3I9mA==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.6]
    key = AQCI+RxhAt4eIhAAYQEJqSNRT7l2WNl/rYQcKQ==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.1]
    key = AQB/+RxhlH8rFxAAL3mb8Kdb+QuWWdJi+RvwGw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.5]
    key = AQCE+RxhKSNsHRAAIyLO5g75tqFVsl6MEEzwXw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.8]
    key = AQCJ+Rxhc0wHJhAA5Bb2kU9Nadpm3UCLASnCfw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.2]
    key = AQB/+RxhhrQCGRAAUhh77gIVhN8zsTbaKMJuHw==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.0]
    key = AQB/+RxhPhh+FRAAc5b0nwiuK6o1AIbjVc6tQg==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.3]
    key = AQCE+RxhJv8PARAAqCzH2br1xJmMTNnqH3I9mA==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [osd.6]
    key = AQCI+RxhAt4eIhAAYQEJqSNRT7l2WNl/rYQcKQ==
        caps mgr = "allow profile osd"
        caps mon = "allow profile osd"
        caps osd = "allow *"
    [mds.mds-1]
    	key = AQDs+RxhAF9vERAAdn6ArdUJ31RLr2sBVkzp3A==
            caps mds = "allow"
            caps mon = "allow profile mds"
            caps osd = "allow *"
    [mds.mds-2]
    	key = AQDs+RxhROoAFxAALAgMfM45wC5ht/vSFN2EzQ==
            caps mds = "allow"
            caps mon = "allow profile mds"
            caps osd = "allow *"
    [mds.mds-3]
    	key = AQDs+Rxhd092FRAArXLIHAhMp2z9zcWDCSoIDQ==
            caps mds = "allow"
            caps mon = "allow profile mds"
            caps osd = "allow *"
    [client.rgw.rgws-1.rgw0]
    	key = AQD9+Rxh0iP2MxAAYY76Js1AaZhzFG44cvcyOw==
            caps mon = "allow rw"
            caps osd = "allow *"
    Copy to Clipboard

  7. 선택 사항: 각 Ceph 모니터 노드에서 모니터 맵을 사용할 수 없는지 확인합니다.

    예제

    [root@mons-1 ~]# ceph-monstore-tool /tmp/monstore get monmap -- --out /tmp/monmap
    [root@mons-1 ~]# monmaptool /tmp/monmap --print
    
    monmaptool: monmap file /tmp/monmap
    monmaptool: couldn't open /tmp/monmap: (2) No such file or directory
    
    Notice theNo such file or directory  error message if monmap is missed
    
    Notice that the “No such file or directory”  error message if monmap is missed
    Copy to Clipboard

  8. 각 Ceph 모니터 노드에서 MONITOR_ID,IP_ADDRESS_OF_MONITOR, FSIDetc/ceph/ceph.conf 파일에서 가져옵니다.

    예제

    [global]
    cluster network = 10.0.208.0/22
    fsid = 9877bde8-ccb2-4758-89c3-90ca9550ffea
    mon host = [v2:10.0.211.00:3300,v1:10.0.211.00:6789],[v2:10.0.211.13:3300,v1:10.0.211.13:6789],[v2:10.0.210.13:3300,v1:10.0.210.13:6789]
    mon initial members = ceph-mons-1, ceph-mons-2, ceph-mons-3
    Copy to Clipboard

  9. Ceph Monitor 노드에서 모니터 맵을 다시 빌드합니다.

    구문

    monmaptool --create --addv MONITOR_ID IP_ADDRESS_OF_MONITOR --enable-all-features --clobber PATH_OF_MONITOR_MAP --fsid FSID
    Copy to Clipboard

    예제

    [root@mons-1 ~]# monmaptool --create --addv mons-1 [v2:10.74.177.30:3300,v1:10.74.177.30:6789] --addv mons-2 [v2:10.74.179.197:3300,v1:10.74.179.197:6789] --addv mons-3 [v2:10.74.182.123:3300,v1:10.74.182.123:6789] --enable-all-features --clobber /root/monmap.mons-1 --fsid 6c01cb34-33bf-44d0-9aec-3432276f6be8
    
    monmaptool: monmap file /root/monmap.mons-1
    monmaptool: set fsid to 6c01cb34-33bf-44d0-9aec-3432276f6be8
    monmaptool: writing epoch 0 to /root/monmap.mon-a (3 monitors)
    Copy to Clipboard

  10. Ceph 모니터 노드에서 생성된 모니터 맵을 확인합니다.

    구문

    monmaptool PATH_OF_MONITOR_MAP --print
    Copy to Clipboard

    예제

    [root@mons-1 ~]# monmaptool /root/monmap.mons-1 --print
    
    monmaptool: monmap file /root/monmap.mons-1
    epoch 0
    fsid 6c01cb34-33bf-44d0-9aec-3432276f6be8
    last_changed 2021-11-23 02:57:23.235505
    created 2021-11-23 02:57:23.235505
    min_mon_release 0 (unknown)
    election_strategy: 1
    0: [v2:10.74.177.30:3300/0,v1:10.74.177.30:6789/0] mon.mons-1
    1: [v2:10.74.179.197:3300/0,v1:10.74.179.197:6789/0] mon.mons-2
    2: [v2:10.74.182.123:3300/0,v1:10.74.182.123:6789/0] mon.mons-3
    Copy to Clipboard

  11. 모니터를 복구하는 Ceph 모니터 노드에서 수집된 맵에서 Ceph Monitor 저장소를 다시 빌드합니다.

    구문

    ceph-monstore-tool /tmp/monstore rebuild -- --keyring KEYRING_PATH  --monmap PATH_OF_MONITOR_MAP
    Copy to Clipboard

    이 예에서 복구는 mons-1 노드에서 실행됩니다.

    예제

    [root@mons-1 ~]# ceph-monstore-tool /tmp/monstore rebuild -- --keyring /tmp/monstore/keyring  --monmap /root/monmap.mons-1
    Copy to Clipboard

  12. monstore 디렉터리의 소유권을 ceph로 변경합니다.

    예제

    [root@mons-1 ~]# chown -R ceph:ceph /tmp/monstore
    Copy to Clipboard

  13. 모든 Ceph 모니터 노드에서 손상된 저장소를 백업하십시오.

    예제

    [root@mons-1 ~]# mv /var/lib/ceph/mon/ceph-mons-1/store.db /var/lib/ceph/mon/ceph-mons-1/store.db.corrupted
    Copy to Clipboard

  14. 모든 Ceph 모니터 노드에서 손상된 저장소를 교체합니다.

    예제

    [root@mons-1 ~]# scp -r /tmp/monstore/store.db mons-1:/var/lib/ceph/mon/ceph-mons-1/
    Copy to Clipboard

  15. 모든 Ceph 모니터 노드에서 새 저장소의 소유자를 변경합니다.

    예제

    [root@mons-1 ~]# chown -R ceph:ceph /var/lib/ceph/mon/ceph-HOSTNAME/store.db
    Copy to Clipboard

  16. 모든 Ceph OSD 노드에서 OSD를 시작합니다.

    예제

    [root@osds-1 ~]# sudo systemctl start ceph-osd.target
    Copy to Clipboard

  17. 모든 Ceph Monitor 노드에서 모니터를 시작합니다.

    예제

    [root@mons-1 ~]# sudo systemctl start ceph-mon.target
    Copy to Clipboard

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat