CentOS Stream 9
Sponsored Link

Ceph Quincy : Add or Remove OSDs2022/06/14

 
This is how to add or remove OSDs from existing Cluster.
                                         |
        +--------------------+           |           +----------------------+
        |   [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] For example, Add a [node04] node for OSD on Admin Node.
For Block device on new [node04] Node, use [/dev/sdb] on this example.
# transfer public key

[root@node01 ~]#
ssh-copy-id node04

# if Firewalld is running, allow service

[root@node01 ~]#
ssh node04 "firewall-cmd --add-service=ceph; firewall-cmd --runtime-to-permanent"

# install required packages

[root@node01 ~]#
ssh node04 "dnf -y install centos-release-ceph-quincy; dnf -y install ceph"
# transfer required files

[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
# configure 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 fce85fe5-0556-4b60-a4af-588e44cd1b9c
Running command: vgcreate --force --yes ceph-7045f99f-721e-442a-97cf-b05c22dabb92 /dev/sdb1
 stdout: Physical volume "/dev/sdb1" successfully created.
 stderr: Not creating system devices file due to existing VGs.
 stdout: Volume group "ceph-7045f99f-721e-442a-97cf-b05c22dabb92" successfully created

.....
.....

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:     fe4fb100-abec-488d-93fe-71b7ae7d9b81
    health: HEALTH_OK

  services:
    mon: 1 daemons, quorum node01 (age 61m)
    mgr: node01(active, since 60m)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 2m), 4 in (since 3m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   9 pools, 257 pgs
    objects: 240 objects, 7.0 MiB
    usage:   157 MiB used, 640 GiB / 640 GiB avail
    pgs:     257 active+clean
[2] To remove an OSD Node from existing Cluster, run commands like follows.
For example, Remove [node04] node.
[root@node01 ~]#
ceph -s

  cluster:
    id:     fe4fb100-abec-488d-93fe-71b7ae7d9b81
    health: HEALTH_OK

  services:
    mon: 1 daemons, quorum node01 (age 61m)
    mgr: node01(active, since 60m)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 2m), 4 in (since 3m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   9 pools, 257 pgs
    objects: 240 objects, 7.0 MiB
    usage:   157 MiB used, 640 GiB / 640 GiB avail
    pgs:     257 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

# specify OSD ID of a node you'd like to remove

[root@node01 ~]#
ceph osd out 3

marked out osd.3.
# live watch cluster status
# after running [ceph osd out ***], rebalancing is executed automatically
# to quit live watch, push [Ctrl + c]

[root@node01 ~]#
ceph -w

  cluster:
    id:     fe4fb100-abec-488d-93fe-71b7ae7d9b81
    health: HEALTH_WARN
            Reduced data availability: 38 pgs inactive, 82 pgs peering
            too many PGs per OSD (257 > max 250)

  services:
    mon: 1 daemons, quorum node01 (age 62m)
    mgr: node01(active, since 61m)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 3m), 3 in (since 6s); 29 remapped pgs
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   9 pools, 257 pgs
    objects: 240 objects, 7.0 MiB
    usage:   130 MiB used, 480 GiB / 480 GiB avail
    pgs:     53.696% pgs not active
             20/720 objects degraded (2.778%)
             119 active+clean
             76  peering
             55  activating
             7   remapped+peering

  io:
    recovery: 0 B/s, 0 objects/s


2022-06-14T17:15:35.228232+0900 mon.node01 [WRN] Health check failed: Degraded data redundancy: 114/720 objects degraded (15.833%), 41 pgs degraded (PG_DEGRADED)
2022-06-14T17:15:36.746011+0900 mon.node01 [WRN] Health check update: Reduced data availability: 12 pgs inactive (PG_AVAILABILITY)
.....
.....

# after status turns to [HEALTH_OK], disable OSD service on the target node

[root@node01 ~]#
ssh node04 "systemctl disable --now ceph-osd@3.service"

Removed /run/systemd/system/ceph-osd.target.wants/ceph-osd@3.service.
# remove the node to specify target OSD ID

[root@node01 ~]#
ceph osd purge 3 --yes-i-really-mean-it

purged osd.3
[root@node01 ~]#
ceph -s

  cluster:
    id:     fe4fb100-abec-488d-93fe-71b7ae7d9b81
    health: HEALTH_OK

  services:
    mon: 1 daemons, quorum node01 (age 67m)
    mgr: node01(active, since 66m)
    mds: 1/1 daemons up
    osd: 3 osds: 3 up (since 19s), 3 in (since 5m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   8 pools, 225 pgs
    objects: 219 objects, 464 KiB
    usage:   149 MiB used, 480 GiB / 480 GiB avail
    pgs:     225 active+clean
Matched Content