Pacemaker : クラスターリソースを設定する (NFS)2024/07/23 |
|
クラスターリソースに NFS サーバーを設定して、アクティブ/パッシブ 構成の NFS サーバーを構築します。
当例では以下のような環境で設定します。事前に下記の項目を設定済みであることが前提です。
+--------------------+
| [ ISCSI Target ] |
| dlp.srv.world |
+----------+---------+
10.0.0.30|
|
+----------------------+ | +----------------------+
| [ Cluster Node#1 ] |10.0.0.51 | 10.0.0.52| [ Cluster Node#2 ] |
| node01.srv.world +----------+----------+ node02.srv.world |
| NFS Server | | | NFS Server |
+----------------------+ | +----------------------+
vip:10.0.0.60
|
+----------+---------+
| [ NFS Clients ] |
| |
+--------------------+
|
| [1] | クラスターを構成する全ノードで、NFS 関連ツールをインストールしておきます。 |
|
root@node01:~# apt -y install nfs-kernel-server nfs-common resource-agents-extra
|
| [2] | LVM 共有ストレージがアクティブとなっているノード上で、NFS リソースを追加します。 以下で Filesystem に設定しているデバイス [/dev/vg_ha/lv_ha] は事前に作成した LVM 共有ストレージです。 |
|
# 現在の状態 root@node01:~# pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 03:59:32 2024 on node01.srv.world
* Last change: Tue Jul 23 03:58:31 2024 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 2 resource instances configured
Node List:
* Online: [ node01.srv.world node02.srv.world ]
Full List of Resources:
* scsi-shooter (stonith:fence_scsi): Started node01.srv.world
* Resource Group: ha_group:
* lvm_ha (ocf:heartbeat:LVM-activate): Started node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
# Filesystem リソース設定 # [nfs_share] : 任意の名称 # [device=***] : 共有ストレージ # [directory=***] : マウントポイント # [group ***] : 共有ストレージと同じグループに設定 root@node01:~# pcs resource create nfs_share ocf:heartbeat:Filesystem device=/dev/vg_ha/lv_ha directory=/home/nfs-share fstype=ext4 group ha_group --future
pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 04:06:22 2024 on node01.srv.world
* Last change: Tue Jul 23 04:05:40 2024 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 3 resource instances configured
Node List:
* Online: [ node01.srv.world node02.srv.world ]
Full List of Resources:
* scsi-shooter (stonith:fence_scsi): Started node01.srv.world
* Resource Group: ha_group:
* lvm_ha (ocf:heartbeat:LVM-activate): Started node01.srv.world
* nfs_share (ocf:heartbeat:Filesystem): Started node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
# リソースが開始した側のノードで自動マウントされる root@node01:~# df -hT /home/nfs-share Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/vg_ha-lv_ha ext4 9.8G 24K 9.3G 1% /home/nfs-share # nfsserver リソース設定 # [nfs_daemon] : 任意の名称 # [nfs_shared_infodir=***] : NFS サーバー関連情報の保管ディレクトリ指定 (自動生成) root@node01:~# pcs resource create nfs_daemon ocf:heartbeat:nfsserver nfs_shared_infodir=/home/nfs-share/nfsinfo nfs_no_notify=true group ha_group --future
# IPaddr2 リソース設定 # クライアントからの NFS アクセスに使用する仮想 IP アドレス root@node01:~# pcs resource create nfs_vip ocf:heartbeat:IPaddr2 ip=10.0.0.60 cidr_netmask=24 group ha_group --future
pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 04:09:11 2024 on node01.srv.world
* Last change: Tue Jul 23 04:09:04 2024 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 5 resource instances configured
Node List:
* Online: [ node01.srv.world node02.srv.world ]
Full List of Resources:
* scsi-shooter (stonith:fence_scsi): Started node01.srv.world
* Resource Group: ha_group:
* lvm_ha (ocf:heartbeat:LVM-activate): Started node01.srv.world
* nfs_share (ocf:heartbeat:Filesystem): Started node01.srv.world
* nfs_daemon (ocf:heartbeat:nfsserver): Started node01.srv.world
* nfs_vip (ocf:heartbeat:IPaddr2): Started node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
|
| [3] | NFS ファイルシステムがマウントされているアクティブなノード上で、エクスポートの設定をします。 |
|
# exportfs リソース設定 # [nfs_root] : 任意の名称 # [clientspec=*** options=*** directory=***] : エクスポートの設定 # [fsid=0] : NFSv4 でのルートポイントとなる root@node01:~# pcs resource create nfs_root ocf:heartbeat:exportfs clientspec=10.0.0.0/255.255.255.0 options=rw,sync,no_root_squash directory=/home/nfs-share/nfs-root fsid=0 group ha_group --future # exportfs リソース設定 root@node01:~# pcs resource create nfs_share01 ocf:heartbeat:exportfs clientspec=10.0.0.0/255.255.255.0 options=rw,sync,no_root_squash directory=/home/nfs-share/nfs-root/share01 fsid=1 group ha_group --future
pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 04:11:18 2024 on node01.srv.world
* Last change: Tue Jul 23 04:11:09 2024 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 7 resource instances configured
Node List:
* Online: [ node01.srv.world node02.srv.world ]
Full List of Resources:
* scsi-shooter (stonith:fence_scsi): Started node01.srv.world
* Resource Group: ha_group:
* lvm_ha (ocf:heartbeat:LVM-activate): Started node01.srv.world
* nfs_share (ocf:heartbeat:Filesystem): Started node01.srv.world
* nfs_daemon (ocf:heartbeat:nfsserver): Started node01.srv.world
* nfs_vip (ocf:heartbeat:IPaddr2): Started node01.srv.world
* nfs_root (ocf:heartbeat:exportfs): Started node01.srv.world
* nfs_share01 (ocf:heartbeat:exportfs): Started node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
root@node01:~# showmount -e Export list for node01.srv.world: /home/nfs-share/nfs-root 10.0.0.0/255.255.255.0 /home/nfs-share/nfs-root/share01 10.0.0.0/255.255.255.0 |
| [4] | 任意のクライアントコンピューターで、設定した仮想 IP アドレス宛に NFS アクセスして動作確認します。 また、マウントした状態でフェイルオーバー等も試してみるとよいでしょう。 |
|
root@client:~# mount -t nfs4 10.0.0.60:share01 /mnt root@client:~# df -hT /mnt Filesystem Type Size Used Avail Use% Mounted on 10.0.0.60:/share01 nfs4 9.8G 0 9.3G 0% /mnt |
| Sponsored Link |
|
|