Ceph Pacific : クラスターの設定 #22023/06/19 |
分散ファイルシステム Ceph をインストールして、ストレージクラスターを構成します。
当例では 3 台 のノードでクラスターを構成します。
3 台 のノードにはそれぞれ空きブロックデバイスがあることが前提です。 (当例では [/dev/sdb] を使用) | +----------------------------+----------------------------+ | | | |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] | |
[2] | 管理ノードから各ノードへ OSD (Object Storage Device) の設定をします。 設定するブロックデバイス (当例では [/dev/sdb]) はフォーマットするため、保存が必要な既存データがある場合は事前にバックアップが必要です。 |
# 各ノードに OSD の設定を実行
root@node01:~# for NODE in node01 node02 node03
do
if [ ! ${NODE} = "node01" ]
then
scp /etc/ceph/ceph.conf ${NODE}:/etc/ceph/ceph.conf
scp /etc/ceph/ceph.client.admin.keyring ${NODE}:/etc/ceph
scp /var/lib/ceph/bootstrap-osd/ceph.keyring ${NODE}:/var/lib/ceph/bootstrap-osd
fi
ssh $NODE \
"chown ceph: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"
done
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 b462202e-109e-4957-bc97-c71b8e74b062 Running command: vgcreate --force --yes ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14 /dev/sdb1 stdout: Physical volume "/dev/sdb1" successfully created. stdout: Volume group "ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14" successfully created Running command: lvcreate --yes -l 40959 -n osd-block-b462202e-109e-4957-bc97-c71b8e74b062 ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14 stdout: Logical volume "osd-block-b462202e-109e-4957-bc97-c71b8e74b062" created. Running command: /usr/bin/ceph-authtool --gen-print-key Running command: /usr/bin/mount -t tmpfs tmpfs /var/lib/ceph/osd/ceph-0 --> Executable selinuxenabled not in PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Running command: /usr/bin/chown -h ceph:ceph /dev/ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14/osd-block-b462202e-109e-4957-bc97-c71b8e74b062 Running command: /usr/bin/chown -R ceph:ceph /dev/dm-2 Running command: /usr/bin/ln -s /dev/ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14/osd-block-b462202e-109e-4957-bc97-c71b8e74b062 /var/lib/ceph/osd/ceph-0/block Running command: /usr/bin/ceph --cluster ceph --name client.bootstrap-osd --keyring /var/lib/ceph/bootstrap-osd/ceph.keyring mon getmap -o /var/lib/ceph/osd/ceph-0/activate.monmap stderr: got monmap epoch 2 --> Creating keyring file for osd.0 Running command: /usr/bin/chown -R ceph:ceph /var/lib/ceph/osd/ceph-0/keyring Running command: /usr/bin/chown -R ceph:ceph /var/lib/ceph/osd/ceph-0/ Running command: /usr/bin/ceph-osd --cluster ceph --osd-objectstore bluestore --mkfs -i 0 --monmap /var/lib/ceph/osd/ceph-0/activate.monmap --keyfile - --osd-data /var/lib/ceph/osd/ceph-0/ --osd-uuid b462202e-109e-4957-bc97-c71b8e74b062 --setuser ceph --setgroup ceph stderr: 2023-06-18T23:14:19.555-0500 7f33c082a040 -1 bluestore(/var/lib/ceph/osd/ceph-0/) _read_fsid unparsable uuid --> ceph-volume lvm prepare successful for: /dev/sdb1 Running command: /usr/bin/chown -R ceph:ceph /var/lib/ceph/osd/ceph-0 Running command: /usr/bin/ceph-bluestore-tool --cluster=ceph prime-osd-dir --dev /dev/ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14/osd-block-b462202e-109e-4957-bc97-c71b8e74b062 --path /var/lib/ceph/osd/ceph-0 --no-mon-config Running command: /usr/bin/ln -snf /dev/ceph-ac45b627-274f-4b8b-baf4-8a81769a1d14/osd-block-b462202e-109e-4957-bc97-c71b8e74b062 /var/lib/ceph/osd/ceph-0/block Running command: /usr/bin/chown -h ceph:ceph /var/lib/ceph/osd/ceph-0/block Running command: /usr/bin/chown -R ceph:ceph /dev/dm-2 Running command: /usr/bin/chown -R ceph:ceph /var/lib/ceph/osd/ceph-0 Running command: /usr/bin/systemctl enable ceph-volume@lvm-0-b462202e-109e-4957-bc97-c71b8e74b062 stderr: Created symlink /etc/systemd/system/multi-user.target.wants/ceph-volume@lvm-0-b462202e-109e-4957-bc97-c71b8e74b062.service → /lib/systemd/system/ceph-volume@.service. Running command: /usr/bin/systemctl enable --runtime ceph-osd@0 stderr: Created symlink /run/systemd/system/ceph-osd.target.wants/ceph-osd@0.service → /lib/systemd/system/ceph-osd@.service. Running command: /usr/bin/systemctl start ceph-osd@0 --> ceph-volume lvm activate successful for osd ID: 0 --> ceph-volume lvm create successful for: /dev/sdb1 ceph.conf 100% 273 359.7KB/s 00:00 ceph.client.admin.keyring 100% 151 753.7KB/s 00:00 ceph.keyring 100% 129 609.2KB/s 00:00 ..... ..... # ステータス確認 # [HEALTH_OK] であれば OK root@node01:~# ceph -s cluster: id: f6eabaad-6442-481b-bfb1-0bb79de773e3 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 9m) mgr: node01(active, since 7m) osd: 3 osds: 3 up (since 2m), 3 in (since 2m) data: pools: 1 pools, 1 pgs objects: 0 objects, 0 B usage: 15 MiB used, 480 GiB / 480 GiB avail pgs: 1 active+clean # OSD ツリー確認 root@node01:~# ceph osd tree ID CLASS WEIGHT TYPE NAME STATUS REWEIGHT PRI-AFF -1 0.46857 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 root@node01:~# ceph df --- RAW STORAGE --- CLASS SIZE AVAIL USED RAW USED %RAW USED hdd 480 GiB 480 GiB 15 MiB 15 MiB 0 TOTAL 480 GiB 480 GiB 15 MiB 15 MiB 0 --- POOLS --- POOL ID PGS STORED OBJECTS USED %USED MAX AVAIL device_health_metrics 1 1 0 B 0 0 B 0 152 GiB root@node01:~# ceph osd df ID CLASS WEIGHT REWEIGHT SIZE RAW USE DATA OMAP META AVAIL %USE VAR PGS STATUS 0 hdd 0.15619 1.00000 160 GiB 5.0 MiB 152 KiB 0 B 4.9 MiB 160 GiB 0.00 1.01 1 up 1 hdd 0.15619 1.00000 160 GiB 5.0 MiB 152 KiB 0 B 4.8 MiB 160 GiB 0.00 1.00 1 up 2 hdd 0.15619 1.00000 160 GiB 5.0 MiB 152 KiB 0 B 4.8 MiB 160 GiB 0.00 1.00 1 up TOTAL 480 GiB 15 MiB 456 KiB 0 B 14 MiB 480 GiB 0.00 MIN/MAX VAR: 1.00/1.01 STDDEV: 0 |
Sponsored Link |