Ceph Pacific : Add or Remove Monitors2022/03/31 |
This is how to add or remove Monitor Daemons 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 Monitor Daemon on Admin Node. |
# transfer public key [root@node01 ~]# ssh-copy-id node04 # if Firewalld is running, allow service [root@node01 ~]# ssh node04 "firewall-cmd --add-service=ceph-mon; firewall-cmd --runtime-to-permanent" # install required packages [root@node01 ~]# ssh node04 "dnf -y install centos-release-ceph-pacific; dnf -y install ceph"
# configure monitor map [root@node01 ~]# FSID=$(grep "^fsid" /etc/ceph/ceph.conf | awk {'print $NF'}) [root@node01 ~]# NODENAME="node04" [root@node01 ~]# NODEIP="10.0.0.54" [root@node01 ~]# monmaptool --add $NODENAME $NODEIP --fsid $FSID /etc/ceph/monmap monmaptool: monmap file /etc/ceph/monmap monmaptool: set fsid to 7912846f-a2bd-407d-8032-0bdb9adf2c50 monmaptool: writing epoch 0 to /etc/ceph/monmap (2 monitors) # configure Monitor Daemin [root@node01 ~]# scp /etc/ceph/ceph.conf node04:/etc/ceph/ceph.conf [root@node01 ~]# scp /etc/ceph/ceph.mon.keyring node04:/etc/ceph [root@node01 ~]# scp /etc/ceph/monmap node04:/etc/ceph [root@node01 ~]# ssh node04 "ceph-mon --cluster ceph --mkfs -i node04 --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring" [root@node01 ~]# ssh node04 "chown -R ceph. /etc/ceph /var/lib/ceph/mon" [root@node01 ~]# ssh node04 "ceph auth get mon. -o /etc/ceph/ceph.mon.keyring" [root@node01 ~]# ssh node04 "systemctl enable --now ceph-mon@node04" [root@node01 ~]# ssh node04 "ceph mon enable-msgr2"
ceph -s cluster: id: 7912846f-a2bd-407d-8032-0bdb9adf2c50 health: HEALTH_OK services: mon: 2 daemons, quorum node01,node04 (age 2m) mgr: node01(active, since 103m) mds: 1/1 daemons up osd: 3 osds: 3 up (since 6m), 3 in (since 8m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 8 pools, 193 pgs objects: 217 objects, 52 KiB usage: 128 MiB used, 240 GiB / 240 GiB avail pgs: 193 active+clean |
[2] | On the new Monitor Daemin Node, If SELinux is enabled, change policy. |
[root@node04 ~]#
vi cephmon.te # create new module cephmon 1.0; require { type ceph_t; type ptmx_t; class chr_file getattr; } #============= ceph_t ============== allow ceph_t ptmx_t:chr_file getattr; checkmodule -m -M -o cephmon.mod cephmon.te [root@node04 ~]# semodule_package --outfile cephmon.pp --module cephmon.mod [root@node04 ~]# semodule -i cephmon.pp |
[3] | To remove a Monitor Daemon from existing Cluster, run commands like follows. For example, Remove [node04] node. |
[root@node01 ~]# ceph -s cluster: id: 7912846f-a2bd-407d-8032-0bdb9adf2c50 health: HEALTH_OK services: mon: 2 daemons, quorum node01,node04 (age 2m) mgr: node01(active, since 103m) mds: 1/1 daemons up osd: 3 osds: 3 up (since 6m), 3 in (since 8m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 8 pools, 193 pgs objects: 217 objects, 52 KiB usage: 128 MiB used, 240 GiB / 240 GiB avail pgs: 193 active+clean # remove Monitor Daemon [root@node01 ~]# ceph mon remove node04 removing mon.node04 at [v2:10.0.0.54:3300/0,v1:10.0.0.54:6789/0], there will be 1 monitors # disable monitor daemon [root@node01 ~]# ssh node04 "systemctl disable --now ceph-mon@node04.service" ceph -s cluster: id: 7912846f-a2bd-407d-8032-0bdb9adf2c50 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 6s) mgr: node01(active, since 115m) mds: 1/1 daemons up osd: 3 osds: 3 up (since 19m), 3 in (since 20m) rgw: 1 daemon active (1 hosts, 1 zones) data: volumes: 1/1 healthy pools: 8 pools, 193 pgs objects: 217 objects, 52 KiB usage: 140 MiB used, 240 GiB / 240 GiB avail pgs: 193 active+clean |
Sponsored Link |