Ceph Nautilus : クラスターの設定
2019/06/12 |
分散ファイルシステム Ceph をインストールして、ストレージクラスターを構成します。
当例では、管理ノード 1台と 3台のストレージノードでクラスターを構成します。
3台のストレージノードにはそれぞれ空きブロックデバイスがあることが前提です。 (当例では [/dev/sdb] を使用) | +--------------------+ | | [dlp.srv.world] |10.0.0.30 | | Ceph-Ansible +-----------+ | | | +--------------------+ | +----------------------------+----------------------------+ | | | |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] |
全ノードで、Ceph 管理用に任意の一般ユーザーを追加しておきます。(名称は [ceph] 以外)
当例では [cent] ユーザーで進めます。 |
[2] | Ceph 管理用に追加した一般ユーザーに sudo による root 権限を付与しておきます。 さらに、Firewalld を有効にしている場合は、SSH サービスの許可が必要です。 いずれも、全ノードで実施しておきます。 |
[root@dlp ~]#
[root@dlp ~]# echo -e 'Defaults:cent !requiretty\ncent ALL = (root) NOPASSWD:ALL' | tee /etc/sudoers.d/ceph [root@dlp ~]# chmod 440 /etc/sudoers.d/ceph firewall-cmd --add-service=ssh --permanent [root@dlp ~]# firewall-cmd --reload |
[3] | 以降は Ceph 管理ユーザーで作業します。 管理ノードから各 Ceph ストレージノードへ、ノンパスフレーズでの SSH 鍵認証接続を設定します。 |
[cent@dlp ~]$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/cent/.ssh/id_rsa): Created directory '/home/cent/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/cent/.ssh/id_rsa. Your public key has been saved in /home/cent/.ssh/id_rsa.pub. The key fingerprint is: SHA256:bIzF6NAyEzpeV2CHOrr0JBgttu95RslBQ9bEDooXVbA cent@dlp.srv.world The key's randomart image is:
[cent@dlp ~]$
vi ~/.ssh/config # 新規作成 ( 各ノードと接続ユーザーを定義する ) Host dlp Hostname dlp.srv.world User cent Host node01 Hostname node01.srv.world User cent Host node02 Hostname node02.srv.world User cent Host node03 Hostname node03.srv.world User cent
[cent@dlp ~]$
chmod 600 ~/.ssh/config # 他ノードに鍵を転送 [cent@dlp ~]$ ssh-copy-id node01 cent@node01.srv.world's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'node01'" and check to make sure that only the key(s) you wanted were added. # 同様に全ノードに鍵を転送 [cent@dlp ~]$ ssh-copy-id node02 [cent@dlp ~]$ ssh-copy-id node03 |
[4] | 管理ノード上で、依存する全ての必要なリポジトリーパッケージをインストールし、その後 Ceph クラスター設定用に Ceph-Ansible をインストールします。 |
[cent@dlp ~]$
[cent@dlp ~]$ |
[5] | 管理ノードから Ceph-Ansible を使用して 各 Ceph ノードの設定を行います。 |
# 新規作成 ceph_origin: repository ceph_repository: community ceph_repository_type: cdn ceph_stable_release: nautilus fetch_directory: ~/ceph-ansible-keys # 監視用のネットワークインターフェースを指定 monitor_interface: eth0 # 自身のネットワークのパブリックネットワークを指定 public_network: 10.0.0.0/24 # クラスター側のネットワークを指定 # パブリックネットワークと同じ場合は以下のように指定 # 専用の別ネットワークを使用する場合は [public_network] と同じ要領で指定 cluster_network: "{{ public_network }}" # 新規作成 # ストレージノードでデータ保管に使用するデバイスを指定 # 複数ある場合は改行して同じ要領で指定する devices: - /dev/sdb # 最終行に追記 # Ceph 管理ユーザーを SSH や Sudo 使用ユーザーに指定 [all:vars] ansible_ssh_user=cent ansible_become=true ansible_become_method=sudo ansible_become_user=root # モニターサービス設定ノードを指定 [mons] node01.srv.world # マネージャーサービス設定ノードを指定 [mgrs] node01.srv.world # OSD (Object Storage Daemon) 設定ノードを指定 [osds] node01.srv.world node02.srv.world node03.srv.world # Ceph クラスター設定 Playbook 実行 [cent@dlp ~]$ cd /usr/share/ceph-ansible [cent@dlp ceph-ansible]$ [cent@dlp ceph-ansible]$ ansible-playbook site.yml ..... ..... PLAY RECAP ********************************************************************* node01.srv.world : ok=243 changed=16 unreachable=0 failed=0 skipped=328 rescued=0 ignored=0 node02.srv.world : ok=114 changed=18 unreachable=0 failed=0 skipped=184 rescued=0 ignored=0 node03.srv.world : ok=114 changed=18 unreachable=0 failed=0 skipped=172 rescued=0 ignored=0 INSTALLER STATUS *************************************************************** Install Ceph Monitor : Complete (0:00:35) Install Ceph Manager : Complete (0:01:22) Install Ceph OSD : Complete (0:03:25) Wednesday 12 June 2019 19:27:08 +0900 (0:00:00.114) 0:06:02.874 ******** =============================================================================== ceph-common : install redhat ceph packages ---------------------------- 116.31s ceph-mgr : install ceph-mgr packages on RedHat or SUSE ----------------- 55.59s ceph-common : install yum plugin priorities ---------------------------- 15.26s ceph-osd : use ceph-volume lvm batch to create bluestore osds ---------- 11.37s ceph-common : install centos dependencies ------------------------------ 10.25s gather and delegate facts ----------------------------------------------- 4.55s ceph-osd : apply operating system tuning -------------------------------- 3.27s ceph-common : configure red hat ceph community repository stable key ---- 2.47s ceph-common : configure red hat ceph community repository stable key ---- 2.23s ceph-common : configure red hat ceph community repository stable key ---- 1.95s ceph-mon : copy keys to the ansible server ------------------------------ 1.87s ceph-infra : open monitor and manager ports ----------------------------- 1.85s ceph-mon : fetch ceph initial keys -------------------------------------- 1.74s ceph-validate : validate provided configuration ------------------------- 1.74s ceph-infra : open osd ports --------------------------------------------- 1.53s ceph-mon : create ceph mgr keyring(s) ----------------------------------- 1.51s ceph-handler : check if the ceph mon socket is in-use ------------------- 1.35s ceph-osd : copy ceph key(s) if needed ----------------------------------- 1.21s ceph-common : install yum plugin priorities ----------------------------- 1.18s ceph-config : generate ceph configuration file: ceph.conf --------------- 1.17s # 動作確認 ([HEALTH_OK] であれば OK) [cent@dlp ceph-ansible]$ ssh node01 "ceph --version" ceph version 14.2.1 (d555a9489eb35f84f2e1ef49b77e19da9d113972) nautilus (stable) ssh node01 "sudo ceph -s" cluster: id: 2865e8b4-2037-4154-b89f-9bf8a9e03c56 health: HEALTH_OK services: mon: 1 daemons, quorum node01 (age 36m) mgr: node01(active, since 28m) osd: 3 osds: 3 up (since 24m), 3 in (since 24m) data: pools: 0 pools, 0 pgs objects: 0 objects, 0 B usage: 3.0 GiB used, 234 GiB / 237 GiB avail pgs: |