openSUSE Leap 16

Ceph Reef : Monitor ノードを追加/削除する2025/10/28

 

既存の Ceph クラスターに Monitor ノードを追加/削除するには、以下のように設定します。

                                         |
        +--------------------+           |           +----------------------+
        |   [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] ノードに、新たに Monitor Daemin を追加します。
# 公開鍵転送

node01:~ #
ssh-copy-id node04

# Firewalld 稼働中の場合はサービス許可

node01:~ #
ssh node04 "firewall-cmd --add-service=ceph-mon; firewall-cmd --runtime-to-permanent"

# 必要なパッケージをインストール

node01:~ #
ssh node04 "zypper -n install ceph"
# モニターマップ設定

node01:~ #
FSID=$(grep "^fsid" /etc/ceph/ceph.conf | awk {'print $NF'})

node01:~ #
NODENAME="node04"

node01:~ #
NODEIP="10.0.0.54"

node01:~ #
monmaptool --add $NODENAME $NODEIP --fsid $FSID /etc/ceph/monmap

monmaptool: monmap file /etc/ceph/monmap
monmaptool: set fsid to a1598936-342f-40c2-babf-f4b61a9e0bf2
monmaptool: writing epoch 0 to /etc/ceph/monmap (2 monitors)

# Monitor Daemin 設定

node01:~ #
scp /etc/ceph/ceph.conf node04:/etc/ceph/ceph.conf

node01:~ #
scp /etc/ceph/ceph.mon.keyring node04:/etc/ceph

node01:~ #
scp /etc/ceph/monmap node04:/etc/ceph

node01:~ #
ssh node04 "ceph-mon --cluster ceph --mkfs -i node04 --monmap /etc/ceph/monmap --keyring /etc/ceph/ceph.mon.keyring"

node01:~ #
ssh node04 "chown -R ceph:ceph /etc/ceph /var/lib/ceph"

node01:~ #
ssh node04 "ceph auth get mon. -o /etc/ceph/ceph.mon.keyring"

node01:~ #
ssh node04 "systemctl enable --now ceph-mon@node04"

node01:~ #
ssh node04 "ceph mon enable-msgr2"
node01:~ #
ceph -s

  cluster:
    id:     a1598936-342f-40c2-babf-f4b61a9e0bf2
    health: HEALTH_OK

  services:
    mon: 2 daemons, quorum node01,node04 (age 7s)
    mgr: node01(active, since 2h)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 5m), 4 in (since 5m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   8 pools, 321 pgs
    objects: 220 objects, 491 KiB
    usage:   277 MiB used, 640 GiB / 640 GiB avail
    pgs:     321 active+clean
[2] 既存のクラスターから Monitor ノードを削除する場合は以下のように実行します。
例として、管理ノードから [node04] ノードを削除します。
node01:~ #
ceph -s

  cluster:
    id:     a1598936-342f-40c2-babf-f4b61a9e0bf2
    health: HEALTH_OK

  services:
    mon: 2 daemons, quorum node01,node04 (age 109s)
    mgr: node01(active, since 2h)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 6m), 4 in (since 7m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   8 pools, 321 pgs
    objects: 220 objects, 491 KiB
    usage:   277 MiB used, 640 GiB / 640 GiB avail
    pgs:     321 active+clean

# [node04] の Monitor Daemon を分離する

node01:~ #
ceph mon remove node04
# 対象ノードの Monitor Daemon を無効化

node01:~ #
ssh node04 "systemctl disable --now ceph-mon@node04.service"

node01:~ #
ceph -s

  cluster:
    id:     a1598936-342f-40c2-babf-f4b61a9e0bf2
    health: HEALTH_OK

  services:
    mon: 1 daemons, quorum node01 (age 8s)
    mgr: node01(active, since 2h)
    mds: 1/1 daemons up
    osd: 4 osds: 4 up (since 7m), 4 in (since 7m)
    rgw: 1 daemon active (1 hosts, 1 zones)

  data:
    volumes: 1/1 healthy
    pools:   8 pools, 321 pgs
    objects: 220 objects, 491 KiB
    usage:   277 MiB used, 640 GiB / 640 GiB avail
    pgs:     321 active+clean
関連コンテンツ