Steps in implementing high-availability on Redhat 7.1:
- Set hostname in /etc/hosts
- yum install pcs fence-agents-all
- firewall-cmd –permanent –add-service=high-availability
- firewall-cmd –add-service=high-availability
- passwd hacluster
- systemctl start pcsd
- systemctl enable pcsd
- pcs cluster auth suppnfs01
- pcs cluster setup –start –name nfspacemaker suppnfs01
- pcs cluster enable –-all
- pcs cluster status
- pcs stonith create imm-fencing-suppnfs01 fence_imm params ipaddr=”192.168.10.7″ pcmk_host_list=”suppnfs01″ pcmk_host_check=”static-list” action=”off” login=”*****” passwd=”*****” delay=”30″
- pcs stonith show imm-fencing-suppnfs01
- pvcreate /dev/mapper/mpatha
- vgcreate vg01 /dev/mapper/mpatha
- lvcreate -L1.6T -n lvnfsshare vg01
- lvs
- ext4 /dev/vg01/lvnfsshare
- mkdir /share
- mount /dev/vg01/lvnfsshare /share
- mkdir –p /share/exports/data
- mkdir –p /share/exports/phpc
- touch /share/exports/data/testfile
- touch /share/exports/phpc/testfile
- umount /dev/vg01/lvnfsshare
- vgchange –an vg01
- vgs –noheadings -o vg_name
[root@suppnfs01 ~]# vgs --noheadings -o vg_name
rhel
vg01
- add line:
volume_list = [ "rhel" ]
to /etc/lvm/lvm.conf
- dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
- reboot;exit
- pcs cluster status
- pcs resource create lvmshare LVM volgrpname=vg01 exclusive=true –group nfsgroup
- pcs resource create nfsshare Filesystem device=/dev/vg01/lvnfsshare directory=/share fstype=ext4 –group nfsgroup
- pcs resource create nfs-daemon nfsserver nfs_shared_infodir=/share/nfsinfo nfs_no_notify=true –group nfsgroup
- pcs resource create nfs-root exportfs clientspec=* options=rw,sync,no_root_squash directory=/share/exports fsid=0 –group nfsgroup
- pcs resource create nfs-home exportfs clientspec=* options=rw,sync,no_root_squash directory=/share/exports/data fsid=1 –group nfsgroup
- pcs resource create nfs-phpc exportfs clientspec=* options=rw,sync,no_root_squash directory=/share/exports/phpc fsid=2 –group nfsgroup
- pcs resource create nfsha_ip IPaddr2 ip=192.168.9.5 cidr_netmask=24 –group nfsgroup
Notes:
- blue items are supposed to run on both servers
- in green items, you may need to add more servers (e.g.”.. suppnfs01 suppnfs02″)
- items in orange color must be repeated for other server
Source: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/High_Availability_Add-On_Administration/