CephFS Monitors

https://ceph.readthedocs.io/en/latest/start/intro/より

Monitors: A Ceph Monitor (ceph-mon) maintains maps of the cluster state, including the monitor map, manager map, the OSD map, the MDS map, and the CRUSH map.
These maps are critical cluster state required for Ceph daemons to coordinate with each other. 
Monitors are also responsible for managing authentication between daemons and clients. 
At least three monitors are normally required for redundancy and high availability.
(deepL先生訳)
モニタ: Cephモニタ(ceph-mon)は、モニタマップ、マネージャマップ、OSDマップ、データシートマップ、およびCRUSHマップなど、クラスタ状態のマップを保持します。
これらのマップは、Cephデーモンが互いに連携するために必要な重要なクラスタ状態です。
モニタは、デーモンとクライアント間の認証の管理も担当します。
通常、冗長性と高可用性のために少なくとも3つのモニタが必要です。

各ノードの状態を監視しているノードっていう感じかな. っで運用時には最低3台必要みたい. cephadmでは5つが既定のように作らてている

作り方はhttps://docs.ceph.com/en/latest/install/manual-deployment/#monitor-bootstrapping

まずceph構成ファイル(/etc/ceph/ceph.conf)を作成します. これは初めからは存在していないファイルです
ただ、その前にクラスターの一意のID(fsid)が必要なので、それを uuidgen コマンドで用意します

[root@ceph-mgr ~]# uuidgen
c2d06c20-9197-40b4-a8c4-1a0604936ce8
[root@ceph-mgr ~]#

っと得られたので、この「c2d06c20-9197-40b4-a8c4-1a0604936ce8」をここでのcephクラスターのIDとします.
っで下記のようにceph構成ファイル(/etc/ceph/ceph.conf)を作る

[root@ceph-mgr ~]# vi /etc/ceph/ceph.conf
[global]
fsid = c2d06c20-9197-40b4-a8c4-1a0604936ce8
mon_initial_members = ceph-mgr
mon_host = 192.168.0.47
public_network = 192.168.0.0/24
cluster_network = 10.10.10.0/24
 
[root@ceph-mgr ~]#

その後クラスターの「キーリング」を作る.
1.まず枠を用意します

[root@ceph-mgr ~]# ceph-authtool --create-keyring /tmp/ceph.mon.keyring --gen-key -n mon. --cap mon 'allow *'
 
[root@ceph-mgr ~]# cat /tmp/ceph.mon.keyring
[mon.]
        key = AQA3SJVla9NWMxAATD9GW2dRoJdnsse9REYc+w==
        caps mon = "allow *"
[root@ceph-mgr ~]#

2−1.次にclient.adminユーザ名目で管理者権限を持つ「管理者キーリング」を作る

[root@ceph-mgr ~]# ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow *' --cap mgr 'allow *'
 
[root@ceph-mgr ~]# cat /etc/ceph/ceph.client.admin.keyring
[client.admin]
        key = AQDbS5VlVukfHhAA6anPiPtOMu5F1cNyaNb0Fg==
        caps mds = "allow *"
        caps mgr = "allow *"
        caps mon = "allow *"
        caps osd = "allow *"
 
[root@ceph-mgr ~]# chown ceph. /etc/ceph/ceph.client.admin.keyring

2−2.client.bootstrap-osdユーザ名目でbootstrap向けの「bootstrap-osd キーリング」を用意します

[root@ceph-mgr ~]# ceph-authtool --create-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring --gen-key -n client.bootstrap-osd --cap mon 'profile bootstrap-osd' --cap mgr 'allow r'
 
[root@ceph-mgr ~]# cat /var/lib/ceph/bootstrap-osd/ceph.keyring
[client.bootstrap-osd]
        key = AQC7TZVltEraAxAAoK7wlF2A0I8m87DAASRSLQ==
        caps mgr = "allow r"
        caps mon = "profile bootstrap-osd"
[root@ceph-mgr ~]#

2−1と2−2で作ったキーを1.の「枠」に組み込みます

[root@ceph-mgr ~]# ceph-authtool /tmp/ceph.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring
 
[root@ceph-mgr ~]# ceph-authtool /tmp/ceph.mon.keyring --import-keyring /var/lib/ceph/bootstrap-osd/ceph.keyring
 
[root@ceph-mgr ~]# 
[root@ceph-mgr ~]# cat /tmp/ceph.mon.keyring
[mon.]
        key = AQA3SJVla9NWMxAATD9GW2dRoJdnsse9REYc+w==
        caps mon = "allow *"
[client.admin]
        key = AQDbS5VlVukfHhAA6anPiPtOMu5F1cNyaNb0Fg==
        caps mds = "allow *"
        caps mgr = "allow *"
        caps mon = "allow *"
        caps osd = "allow *"
[client.bootstrap-osd]
        key = AQC7TZVltEraAxAAoK7wlF2A0I8m87DAASRSLQ==
        caps mgr = "allow r"
        caps mon = "profile bootstrap-osd"
[root@ceph-mgr ~]#

その後に「モニターマップ」を作る

[root@ceph-mgr ~]# monmaptool --create --add mgr 192.168.0.47 --fsid c2d06c20-9197-40b4-a8c4-1a0604936ce8 /tmp/monmap
monmaptool: monmap file /tmp/monmap
setting min_mon_release = pacific
monmaptool: set fsid to c2d06c20-9197-40b4-a8c4-1a0604936ce8
monmaptool: writing epoch 0 to /tmp/monmap (1 monitors)
 
[root@ceph-mgr ~]# file /tmp/monmap
/tmp/monmap: data
[root@ceph-mgr ~]#

準備できた「キーリング」と「モニターマップ」をモニターデーモンに組み込みます

[root@ceph-mgr ~]# chown ceph. /tmp/ceph.mon.keyring
 
[root@ceph-mgr ~]# sudo -u ceph mkdir /var/lib/ceph/mon/ceph-ceph-mgr
(「/var/lib/ceph/mon/{cluster-name}-{hostname}」形式)
 
[root@ceph-mgr ~]# sudo -u ceph ceph-mon --cluster ceph --mkfs -i ceph-mgr --monmap /tmp/monmap --keyring /tmp/ceph.mon.keyring
(「/var/lib/ceph/mon/ceph-ceph-mgr」と「/var/lib/ceph/mon/ceph-ceph-mgr/store.db」コンテンツが作られます)
 
[root@ceph-mgr ~]#

このceph-monの実行で下記のように新たなファイルが用意される

[root@ceph-mgr ~]# ls -l /var/lib/ceph/mon/
total 0
drwxr-xr-x. 3 ceph ceph 55 Jan  3 23:13 ceph-ceph-mgr
 
[root@ceph-mgr ~]# ls -R /var/lib/ceph/mon/ceph-ceph-mgr/
/var/lib/ceph/mon/ceph-ceph-mgr/:
keyring  kv_backend  store.db
 
/var/lib/ceph/mon/ceph-ceph-mgr/store.db:
000004.log  CURRENT  IDENTITY  LOCK  MANIFEST-000005  OPTIONS-000007
[root@ceph-mgr ~]#

っでモニターデーモンを起動します.
デーモンファイル「ceph-mon@.service」を拝見するとExecStartで「%i」が使われているので「ceph-mon@ceph-mgr」として有効にする.

[root@ceph-mgr ~]# less /usr/lib/systemd/system/ceph-mon@.service
 :
ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i --setuser ceph --setgroup ceph
 :
[root@ceph-mgr ~]# systemctl enable ceph-mon@ceph-mgr.service
Created symlink /etc/systemd/system/ceph-mon.target.wants/ceph-mon@ceph-mgr.service → /usr/lib/systemd/system/ceph-mon@.service.
 
[root@ceph-mgr ~]# systemctl start ceph-mon@ceph-mgr.service

もしエラーが発生したら調整後「systemctl reset-failed ceph-mon@mgr.service」を実施してから起動させます

動作確認

[root@ceph-mgr ~]# ceph -s
  cluster:
    id:     c2d06c20-9197-40b4-a8c4-1a0604936ce8
    health: HEALTH_WARN
            mon is allowing insecure global_id reclaim
 
  services:
    mon: 1 daemons, quorum ceph-mgr (age 15s)
    mgr: no daemons active
    osd: 0 osds: 0 up, 0 in
 
  data:
    pools:   0 pools, 0 pgs
    objects: 0 objects, 0 B
    usage:   0 B used, 0 B / 0 B avail
    pgs:
 
[root@ceph-mgr ~]#

あ「mon is allowing insecure global_id reclaim」と出る. これについては後述

Monitorを追加する

初回の「/etc/ceph/ceph.conf」に全てのMonitorを登録してもいいのですが、
後に追加の事もあり得るのでその方法を示す.

参照先https://docs.ceph.com/en/latest/rados/operations/add-or-rm-mons/

はじめに初期のMonitor(ceph-mgr)の「/etc/ceph/ceph.conf」と「/etc/ceph/ceph.client.admin.keyring」を追加Monitor(ceph-mds)にコピーします
事前にcephパッケージのインストールは済んでいることとします

[root@ceph-mgr ~]# scp /etc/ceph/ceph.conf                     root@ceph-mds:/etc/ceph/ceph.conf
 
[root@ceph-mgr ~]# scp /etc/ceph/ceph.client.admin.keyring     root@ceph-mds:/etc/ceph/ceph.client.admin.keyring

コピー後、追加するMonitorノードにて下記を実行します

[root@ceph-mgr ~]# ssh ceph-mds
root@ceph-mds's password:
Last login: Wed Jan  3 23:48:49 2024 from 192.168.0.3
 
[root@ceph-mds ~]# id ceph
uid=167(ceph) gid=167(ceph) groups=167(ceph)
 
[root@ceph-mds ~]# chown ceph. /etc/ceph/*
[root@ceph-mds ~]# sudo -u ceph mkdir /var/lib/ceph/mon/ceph-ceph-mds
[root@ceph-mds ~]# ceph auth get mon. -o /tmp/key-filename
[root@ceph-mds ~]# ceph mon getmap -o /tmp/map-filename
[root@ceph-mds ~]# sudo -u ceph ceph-mon -i ceph-mds --mkfs --monmap /tmp/map-filename --keyring /tmp/key-filename
[root@ceph-mds ~]# sudo -u ceph ceph-mon -i ceph-mds --public-addr 192.168.0.48

これで2つめのmonitorが起動します. っで三つ目を作ります

同じように mon2 にもMonitorを導入します

[root@ceph-mgr ~]# scp /etc/ceph/ceph.conf                   root@ceph-osd1:/etc/ceph/ceph.conf
[root@ceph-mgr ~]# scp /etc/ceph/ceph.client.admin.keyring   root@ceph-osd1:/etc/ceph/ceph.client.admin.keyring

その後上記と同じように設定します

ssh -l root ceph-osd1
 
chown ceph. /etc/ceph/*
sudo -u ceph mkdir /var/lib/ceph/mon/ceph-ceph-osd1
ceph auth get mon. -o /tmp/key-filename
ceph mon getmap -o /tmp/map-filename
 
sudo -u ceph ceph-mon -i ceph-osd1 --mkfs --monmap /tmp/map-filename --keyring /tmp/key-filename
sudo -u ceph ceph-mon -i ceph-osd1 --public-addr 192.168.0.49

このあと、どのMonitorでもいいのだが、「ceph -s」とすると下記のようになる

[root@ceph-osd1 ~]# ceph -s
  cluster:
    id:     c2d06c20-9197-40b4-a8c4-1a0604936ce8
    health: HEALTH_WARN
            mons are allowing insecure global_id reclaim
 
  services:
    mon: 3 daemons, quorum ceph-mgr,ceph-mds,ceph-osd1 (age 2s)
    mgr: no daemons active
    osd: 0 osds: 0 up, 0 in
 
  data:
    pools:   0 pools, 0 pgs
    objects: 0 objects, 0 B
    usage:   0 B used, 0 B / 0 B avail
    pgs:
 
[root@ceph-osd1 ~]#

3つ揃えても「mons are allowing insecure global_id reclaim」と表示されてしまう.
これは

ceph config set mon  mon_warn_on_insecure_global_id_reclaim_allowed false
ceph config set mon  mon_warn_on_insecure_global_id_reclaim false

で逃げられます.

そして全てのMonitorノードの /etc/ceph/ceph.confを書き換える

[global]
fsid = c2d06c20-9197-40b4-a8c4-1a0604936ce8
mon_initial_members = ceph-mgr,ceph-mds,ceph-osd1
mon_host = 192.168.0.47,192.168.0.48,192.168.0.49
public_network = 192.168.0.0/24
cluster_network = 10.10.10.0/24

留意
一度Monitorとして追加登録したら、そのMonitorを/etc/ceph/ceph.confに登録すること。
それをしないでMonitoを再起動するとcephにアクセスできなくなる
修正方法はこちらhttps://docs.ceph.com/en/latest/rados/operations/add-or-rm-mons/#removing-monitors-from-an-unhealthy-cluster

systemctl stop ceph-mon@mgr
sudo -u ceph ceph-mon -i mgr --extract-monmap /tmp/monmap
sudo -u ceph monmaptool /tmp/monmap --rm mon1
sudo -u ceph ceph-mon -i a --inject-monmap /tmp/monmap
systemctl start ceph-mon@mgr
最新の60件
2025-02-17 2025-02-15 2025-02-14 2025-02-12 2025-02-03 2025-02-02 2025-02-01 2025-01-27 2025-01-26 2025-01-25 2025-01-24 2025-01-23 2025-01-20 2025-01-13 2025-01-12 2025-01-08 2024-12-30 2024-12-29 2024-12-22 2024-12-20 2024-12-17 2024-12-15 2024-12-14 2024-12-12 2024-12-11 2024-12-10 2024-12-09 2024-12-08 2024-11-28 2024-11-22 2024-11-15 2024-11-14 2024-11-12 2024-11-06 2024-11-05 2024-11-04 2024-11-02 2024-11-01 2024-10-28 2024-10-27 2024-10-23 2024-10-18 2024-10-17 2024-10-15 2024-10-14

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2024-01-07 (日) 15:38:28