Ceph Quincy : OSD を追加/削除する2022/06/14 |
既存の Ceph クラスターに OSD を追加/削除するには、以下のように設定します。
| +--------------------+ | +----------------------+ | [dlp.srv.world] |10.0.0.30 | 10.0.0.31| [www.srv.world] | | Ceph Client +-----------+-----------+ RADOSGW | | | | | | +--------------------+ | +----------------------+ +----------------------------+----------------------------+ | | | |10.0.0.51 |10.0.0.52 |10.0.0.53 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [node01.srv.world] | | [node02.srv.world] | | [node03.srv.world] | | Object Storage +----+ Object Storage +----+ Object Storage | | Monitor Daemon | | | | | | Manager Daemon | | | | | +-----------------------+ +-----------------------+ +-----------------------+ |
[1] | 例として、管理ノードから [node04] ノードに、新たに OSD を追加します。 [node04] ノード上で Ceph 用に設定するブロックデバイスは [/dev/sdb] を使用します。 |
# 公開鍵転送 [root@node01 ~]# ssh-copy-id node04 # Firewalld 稼働中の場合はサービス許可 [root@node01 ~]# ssh node04 "firewall-cmd --add-service=ceph; firewall-cmd --runtime-to-permanent" # 必要なパッケージをインストール [root@node01 ~]# ssh node04 "dnf -y install centos-release-ceph-quincy epel-release; dnf -y install ceph"
# 必要なファイルを転送 [root@node01 ~]# scp /etc/ceph/ceph.conf node04:/etc/ceph/ceph.conf [root@node01 ~]# scp /etc/ceph/ceph.client.admin.keyring node04:/etc/ceph [root@node01 ~]# scp /var/lib/ceph/bootstrap-osd/ceph.keyring node04:/var/lib/ceph/bootstrap-osd
# OSD の設定 [root@node01 ~]# ssh node04 \ "chown ceph. /etc/ceph/ceph.* /var/lib/ceph/bootstrap-osd/*; \ parted --script /dev/sdb 'mklabel gpt'; \ parted --script /dev/sdb "mkpart primary 0% 100%"; \ ceph-volume lvm create --data /dev/sdb1" Running command: /usr/bin/ceph-authtool --gen-print-key Running command: /usr/bin/ceph --cluster ceph --name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/ceph.keyring -i - osd new 6de3f781-8332-4e35-8736-75cf1f2c1953 Running command: vgcreate --force --yes ceph-b6f32fdf-be73-4679-ad71-0a457e8ca479 /dev/sdb1 stdout: Physical volume "/dev/sdb1" successfully created. stdout: Volume group "ceph-b6f32fdf-be73-4679-ad71-0a457e8ca479" successfully created Running command: lvcreate --yes -l 40959 -n osd-block-6de3f781-8332-4e35-8736-75cf1f2c1953 ceph-b6f32fdf-be73-4679-ad71-0a457e8ca479 ..... ..... Running command: /usr/bin/systemctl enable --runtime ceph-osd@3 stderr: Created symlink /run/systemd/system/ceph-osd.target.wants/ceph-osd@3.service → /usr/lib/systemd/system/ceph-osd@.service. Running command: /usr/bin/systemctl start ceph-osd@3 --> ceph-volume lvm activate successful for osd ID: 3 --> ceph-volume lvm create successful for: /dev/sdb1 [root@node01 ~]# ceph -s cluster: id: 8df33401-6131-4c08-9ceb-3894ab029257 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 5h) mgr: node01(active, since 41m) mds: 1/1 daemons up osd: 4 osds: 4 up (since 3m), 4 in (since 4m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 7 pools, 209 pgs objects: 217 objects, 466 KiB usage: 204 MiB used, 640 GiB / 640 GiB avail pgs: 209 active+clean |
[2] | 既存のクラスターから OSD を削除する場合は以下のように実行します。 例として、管理ノードから [node04] ノードを削除します。 |
[root@node01 ~]# ceph -s cluster: id: 8df33401-6131-4c08-9ceb-3894ab029257 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 5h) mgr: node01(active, since 42m) mds: 1/1 daemons up osd: 4 osds: 4 up (since 4m), 4 in (since 5m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 7 pools, 209 pgs objects: 217 objects, 466 KiB usage: 205 MiB used, 640 GiB / 640 GiB avail pgs: 209 active+clean[root@node01 ~]# ceph osd tree ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF -1 0.62476 root default -3 0.15619 host node01 0 hdd 0.15619 osd.0 up 1.00000 1.00000 -5 0.15619 host node02 1 hdd 0.15619 osd.1 up 1.00000 1.00000 -7 0.15619 host node03 2 hdd 0.15619 osd.2 up 1.00000 1.00000 -9 0.15619 host node04 3 hdd 0.15619 osd.3 up 1.00000 1.00000 # 削除したい OSD の ID を指定してクラスターから分離する [root@node01 ~]# ceph osd out 3 marked out osd.3. # クラスターステータスを リアルタイムウォッチ する # [ceph osd out ***] 実行後、リバランスが実行されデータが再配置される # リアルタイムウォッチを終了する場合は [Ctrl + c] [root@node01 ~]# ceph -w cluster: id: 8df33401-6131-4c08-9ceb-3894ab029257 health: HEALTH_WARN Reduced data availability: 1 pg inactive Degraded data redundancy: 45/651 objects degraded (6.912%), 23 pgs degraded services: mon: 1 daemons, quorum node01 (age 5h) mgr: node01(active, since 43m) mds: 1/1 daemons up osd: 4 osds: 4 up (since 5m), 3 in (since 12s); 40 remapped pgs rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 7 pools, 209 pgs objects: 217 objects, 466 KiB usage: 173 MiB used, 480 GiB / 480 GiB avail pgs: 4.306% pgs not active 45/651 objects degraded (6.912%) 134/651 objects misplaced (20.584%) 163 active+clean 17 active+recovering+undersized+degraded+remapped 9 active+remapped+backfilling 5 active+recovering 4 activating+undersized+degraded+remapped 3 activating+undersized+remapped 3 active+recovering+undersized+remapped 2 active+recovery_wait+undersized+degraded+remapped 1 activating 1 activating+remapped 1 active+remapped+backfill_wait io: recovery: 0 B/s, 0 objects/s 2022-06-14T14:35:14.828371+0900 mon.node01 [INF] Health check cleared: PG_AVAILABILITY (was: Reduced data availability: 1 pg inactive) ..... ..... # クラスターステータスが [HEALTH_OK] になったのち、対象ノードの OSD サービスを無効化 [root@node01 ~]# ssh node04 "systemctl disable --now ceph-osd@3.service" Removed /run/systemd/system/ceph-osd.target.wants/ceph-osd@3.service. # 対象ノードの OSD ID を指定してクラスターから削除する [root@node01 ~]# ceph osd purge 3 --yes-i-really-mean-it purged osd.3 ceph -s cluster: id: 8df33401-6131-4c08-9ceb-3894ab029257 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 5h) mgr: node01(active, since 47m) mds: 1/1 daemons up osd: 3 osds: 3 up (since 10s), 3 in (since 4m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 7 pools, 209 pgs objects: 217 objects, 466 KiB usage: 194 MiB used, 480 GiB / 480 GiB avail pgs: 209 active+clean |
Sponsored Link |
|