====== 2021.09.25 PCS NFS ====== ===== NFSクラスタを組む方法 ===== nfsserv01, nfsserv02でCeph RBDをmapして、ZFSとしてインポートしたものをNFSクラスタで利用する設定 pcs cluster auth nfsserv01 nfsserv02 <> /dev/tty pcs cluster setup --name pcs_cluster nfsserv01 nfsserv02 --transport udpu pcs cluster start --all --wait=60 pcs cluster cib tmp-cib.xml cp tmp-cib.xml tmp-cib.xml.deltasrc pcs -f tmp-cib.xml property set stonith-enabled=false pcs -f tmp-cib.xml property set no-quorum-policy=ignore pcs -f tmp-cib.xml \ resource defaults migration-threshold=1 resource-stickiness=INFINITY pcs -f tmp-cib.xml resource op defaults timeout=120s pcs -f tmp-cib.xml resource create nfsserver ocf:heartbeat:nfsserver \ nfs_shared_infodir=/var/lib/nfs \ op monitor interval=10s on-fail=restart timeout=10s start interval=0s \ timeout=20s stop interval=0s timeout=20s pcs -f tmp-cib.xml resource create nfs_exportfs ocf:heartbeat:exportfs \ clientspec=192.168.0.0/24 directory=/home fsid=root \ options=rw,async,no_root_squash \ op monitor interval=10s timeout=180s start interval=0s timeout=40s stop \ interval=0s timeout=120s pcs -f tmp-cib.xml resource create zfs_pool01 ocf:heartbeat:ZFS pool=pool01 \ op monitor interval=5s timeout=30s start interval=0s timeout=90 stop \ interval=0s timeout=90 pcs -f tmp-cib.xml resource create rbd_testimage01 ocf:ceph:rbd.in \ cephconf=/etc/ceph/ceph.conf name=testimage01 pool=testpool01 user=admin \ op monitor interval=10s timeout=20s start interval=0s timeout=20 stop \ interval=0s timeout=20 pcs -f tmp-cib.xml resource clone rbd_testimage01 pcs -f tmp-cib.xml constraint order rbd_testimage01-clone \ then zfs_pool01 id=order-rbd_testimage01-clone-zfs_pool01-mandatory pcs -f tmp-cib.xml constraint order stop zfs_pool01 \ then rbd_testimage01-clone \ id=order-zfs_pool01-rbd_testimage01-clone-mandatory pcs -f tmp-cib.xml resource create rs_vip ocf:heartbeat:IPaddr2 \ cidr_netmask=24 ip=192.168.0.11 nic=bond0 \ op monitor interval=5s on-fail=restart start interval=0s timeout=20s stop \ interval=0s timeout=20s pcs -f tmp-cib.xml resource create rs_dummy ocf:pacemaker:Dummy \ state=/home/hacluster/pm-dummy \ op migrate_from interval=0s timeout=20 migrate_to interval=0s timeout=20 \ monitor interval=10 timeout=20 reload interval=0s timeout=20 start \ interval=0s timeout=20 stop interval=0s timeout=20 pcs -f tmp-cib.xml \ resource group add gr_nfs zfs_pool01 nfsserver nfs_exportfs rs_vip rs_dummy pcs cluster cib-push tmp-cib.xml diff-against=tmp-cib.xml.deltasrc ==== NFSv4 NFSv3混在 ==== ここのfsid が重要で、fsid=rootにするとNFSv4では、そのディレクトリを/(root)として扱います。 ※fsid=root は fsid=0 と同じ # tree /home/ /home/ └── nfs01 そのため、上記のディレクトリ構成の場合nfs01をマウントす時は下記のようになります。 NFSv3 mount 192.168.0.11:/home/nfs01 /mnt NFSv4 mount 192.168.0.11:/nfs01 /mnt NFSv3 NFSv4両方とも同じパスでマウントしたい場合は、fsid=1~を指定していくと可能です。 pcs resource update nfs_exportfs ocf:heartbeat:exportfs \ clientspec=10.0.0.0/8 directory=/home fsid=1 \ options=rw,async,no_root_squash \ op monitor interval=10s timeout=180s start interval=0s timeout=40s stop \ interval=0s timeout=120s ===== Heartbeat ZFS ===== ZFSのインポートができるheartbeat ZFSはこちら curl -L -o /usr/lib/ocf/resource.d/heartbeat/ZFS https://raw.githubusercontent.com/skiselkov/stmf-ha/master/heartbeat/ZFS chmod 755 /usr/lib/ocf/resource.d/heartbeat/ZFS {{tag>日記 nfs pcs}}