# mkfs.ext4 /dev/nfsdata_vg/nfsdata_lv mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=8 blocks, Stripe width=8 blocks 145965056 inodes, 1167692800 blocks 58384640 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=3315597312 35636 block groups 32768 blocks per group, 32768 fragments per group 4096 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
创造 /nfsshare 目录,挂载 ext4 文件系统:
1 2
# mkdir /nfsshare # mount /dev//dev/nfsdata_vg/nfsdata_lv /nfsshare
创建 exports 目录,之后会设置为NFS的共享目录:
1
# mkdir /nfsshare/exports
卸载刚刚挂载的文件系统,并停用 nfsdata_vg 卷组:
1 2
# umount /nfsshare # vgchange -an nfsdata_vg
停用后, nfsdata_vg 卷组不再可见:
1 2
# ll /dev/nfsdata_vg ls: cannot access /dev/nfsdata_vg: No such file or directory
Sending 'pacemaker_remote authkey' to 'nfs01', 'nfs02' nfs01: successful distribution of the file 'pacemaker_remote authkey' nfs02: successful distribution of the file 'pacemaker_remote authkey' Sending cluster config files to the nodes... nfs01: Succeeded nfs02: Succeeded
Synchronizing pcsd certificates on nodes nfs01, nfs02... nfs01: Success nfs02: Success Restarting pcsd on the nodes in order to reload the certificates... nfs01: Success nfs02: Success
# pcs cluster status Cluster Status: Stack: corosync Current DC: nfs02 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Tue Aug 10 00:05:12 2021 Last change: Mon Aug 9 16:13:36 2021 by hacluster via crmd on nfs02 2 nodes configured 0 resource instances configured
PCSD Status: nfs01: Online nfs02: Online
查看当前节点的集群通信是否正常:
1 2 3 4 5 6
# corosync-cfgtool -s Printing ring status. Local node ID 1 RING ID 0 id = 172.16.0.11 status = ring 0 active with no faults
查看集群节点信息:
1 2 3 4 5 6 7
# pcs status corosync
Membership information ---------------------- Nodeid Votes Name 1 1 nfs01 (local) 2 1 nfs02
# pcs resource show Resource Group: nfsgroup nfsdata_lvm (ocf:heartbeat:LVM): Started nfs01 XFS (ocf:heartbeat:Filesystem): Started nfs01 nfs-daemon (ocf:heartbeat:nfsserver): Started nfs01 nfs-export (ocf:heartbeat:exportfs): Started nfs01 VIP (ocf:heartbeat:IPaddr2): Started nfs01 nfs-notify (ocf:heartbeat:nfsnotify): Started nfs01
# Cluster name: nfsdata_cluster Stack: corosync Current DC: nfs02 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Fri Aug 13 23:18:24 2021 Last change: Fri Aug 13 23:17:21 2021 by root via cibadmin on nfs01
Resource Group: nfsgroup nfsdata_lvm (ocf:heartbeat:LVM): Started nfs01 XFS (ocf:heartbeat:Filesystem): Started nfs01 nfs-daemon (ocf:heartbeat:nfsserver): Started nfs01 nfs-export (ocf:heartbeat:exportfs): Started nfs01 VIP (ocf:heartbeat:IPaddr2): Started nfs01 nfs-notify (ocf:heartbeat:nfsnotify): Started nfs01
# mount | grep nfsshare /dev/mapper/nfsdata_vg-nfsdata_lv on /nfsshare type ext4 (rw,relatime,seclabel,stripe=8,data=ordered) sunrpc on /nfsshare/nfsinfo/rpc_pipefs type rpc_pipefs (rw,relatime)
# pcs status Cluster name: nfsdata_cluster Stack: corosync Current DC: nfs02 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Tue Aug 17 10:06:08 2021 Last change: Tue Aug 17 09:58:16 2021 by hacluster via crmd on nfs01
Resource Group: nfsgroup nfsdata_lvm (ocf:heartbeat:LVM): Started nfs02 XFS (ocf:heartbeat:Filesystem): Started nfs02 nfs-daemon (ocf:heartbeat:nfsserver): Started nfs02 nfs-export (ocf:heartbeat:exportfs): Started nfs02 VIP (ocf:heartbeat:IPaddr2): Started nfs02 nfs-notify (ocf:heartbeat:nfsnotify): Started nfs02
# pcs status Cluster name: nfsdata_cluster Stack: corosync Current DC: nfs02 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Tue Aug 17 18:09:54 2021 Last change: Tue Aug 17 09:58:16 2021 by hacluster via crmd on nfs01
Resource Group: nfsgroup nfsdata_lvm (ocf:heartbeat:LVM): Started nfs02 XFS (ocf:heartbeat:Filesystem): Started nfs02 nfs-daemon (ocf:heartbeat:nfsserver): Started nfs02 nfs-export (ocf:heartbeat:exportfs): Started nfs02 VIP (ocf:heartbeat:IPaddr2): Started nfs02 nfs-notify (ocf:heartbeat:nfsnotify): Started nfs02
# pcs status Cluster name: nfsdata_cluster Stack: corosync Current DC: nfs01 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Tue Aug 17 22:02:42 2021 Last change: Tue Aug 17 13:47:56 2021 by root via cibadmin on nfs01
Resource Group: nfsgroup nfsdata_lvm (ocf:heartbeat:LVM): Started nfs01 XFS (ocf:heartbeat:Filesystem): Started nfs01 nfs-daemon (ocf:heartbeat:nfsserver): Started nfs01 nfs-export (ocf:heartbeat:exportfs): Started nfs01 VIP (ocf:heartbeat:IPaddr2): Started nfs01 nfs-notify (ocf:heartbeat:nfsnotify): Started nfs01
# pcs status Cluster name: nfsdata_cluster Stack: corosync Current DC: nfs01 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum Last updated: Tue Aug 17 14:28:21 2021 Last change: Tue Aug 17 13:47:56 2021 by root via cibadmin on nfs01