Ubuntu 24.04
Sponsored Link

Ceph Squid : Configure Cluster #22024/05/03

 
Install Distributed File System Ceph to Configure Storage Cluster.
For example on here, Configure Ceph Cluster with 3 Nodes like follows.
Furthermore, each Storage Node has a free block device to use on Ceph Nodes.
(use [/dev/sdb] on this example)
                                         |
            +----------------------------+----------------------------+
            |                            |                            |
            |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] Configure OSD (Object Storage Device) to each Node from Admin Node.
Block devices ([/dev/sdb] on this example) are formatted for OSD, Be careful if some existing data are saved.
# configure settings for OSD to each Node

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 8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632
Running command: vgcreate --force --yes ceph-3f745a43-ac41-4f09-b425-aa788f62aaef /dev/sdb1
 stdout: Physical volume "/dev/sdb1" successfully created.
 stdout: Volume group "ceph-3f745a43-ac41-4f09-b425-aa788f62aaef" successfully created
Running command: lvcreate --yes -l 40959 -n osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632 ceph-3f745a43-ac41-4f09-b425-aa788f62aaef
 stdout: Logical volume "osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632" 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:/usr/games:/usr/local/games:/snap/bin
Running command: /usr/bin/chown -h ceph:ceph /dev/ceph-3f745a43-ac41-4f09-b425-aa788f62aaef/osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632
Running command: /usr/bin/chown -R ceph:ceph /dev/dm-1
Running command: /usr/bin/ln -s /dev/ceph-3f745a43-ac41-4f09-b425-aa788f62aaef/osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632 /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 8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632 --setuser ceph --setgroup ceph
--> 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-3f745a43-ac41-4f09-b425-aa788f62aaef/osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632 --path /var/lib/ceph/osd/ceph-0 --no-mon-config
Running command: /usr/bin/ln -snf /dev/ceph-3f745a43-ac41-4f09-b425-aa788f62aaef/osd-block-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632 /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-1
Running command: /usr/bin/chown -R ceph:ceph /var/lib/ceph/osd/ceph-0
Running command: /usr/bin/systemctl enable ceph-volume@lvm-0-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632
 stderr: Created symlink /etc/systemd/system/multi-user.target.wants/ceph-volume@lvm-0-8ccb4e78-8a6a-428e-8dad-d7ac1ee0a632.service → /usr/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 → /usr/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   263.2KB/s   00:00
ceph.client.admin.keyring                     100%  151   154.0KB/s   00:00
ceph.keyring                                  100%  129   716.1KB/s   00:00
.....
.....

# confirm cluster status
# that's OK if [HEALTH_OK]

root@node01:~#
ceph -s

  cluster:
    id:     3666a474-14e0-4c5f-ad1e-daf2e30aed8f
    health: HEALTH_OK

  services:
    mon: 1 daemons, quorum node01 (age 15m)
    mgr: node01(active, since 14m)
    osd: 3 osds: 3 up (since 3m), 3 in (since 3m)

  data:
    pools:   1 pools, 1 pgs
    objects: 2 objects, 449 KiB
    usage:   80 MiB used, 480 GiB / 480 GiB avail
    pgs:     1 active+clean

# confirm OSD tree

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  80 MiB    80 MiB       0.02
TOTAL  480 GiB  480 GiB  80 MiB    80 MiB       0.02

--- POOLS ---
POOL  ID  PGS   STORED  OBJECTS     USED  %USED  MAX AVAIL
.mgr   1    1  449 KiB        2  1.3 MiB      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   27 MiB  588 KiB    1 KiB  26 MiB  160 GiB  0.02  1.00    1      up
 1    hdd  0.15619   1.00000  160 GiB   27 MiB  588 KiB    1 KiB  26 MiB  160 GiB  0.02  1.00    1      up
 2    hdd  0.15619   1.00000  160 GiB   27 MiB  588 KiB    1 KiB  26 MiB  160 GiB  0.02  1.00    1      up
                       TOTAL  480 GiB   80 MiB  1.7 MiB  4.7 KiB  79 MiB  480 GiB  0.02
MIN/MAX VAR: 1.00/1.00  STDDEV: 0
Matched Content