Monday, October 29, 2018

High availability for NFS on Azure VMs on Ubuntu 18.04 LTS

I was trying to follow this guide however realised that I do not have SUSE enterprise license to play with, generally I am more familiar with Red Hat hower I decided to give ubuntu a go this time. 

a few important adjustment need to be done to make this working:


sudo apt-get install -y drbd8-utils
sudo apt-get install nfs-kernel-server
sudo apt install pacemaker corosync fence-agents
sudo apt install crmsh
sudo apt install netcat

#I can't get azure fencing agent working so I used sbd fencing
#sudo pip install azure
#sudo pip install azure-common
#sudo pip install azure-mgmt-compute

sudo apt install sbd

adjust nfs v4 grace timeout:

sudo vi /etc/default/nfs-kernel-server
Add:  NFSD_V4_GRACE=10

full configuration for pacemaker: 

george@nfs-1:~$ sudo crm configure show
node 1: nfs-0
node 2: nfs-1
primitive drbd_NW1_nfs ocf:linbit:drbd \
        params drbd_resource=NW1-nfs \
        op monitor interval=15 role=Master \
        op monitor interval=30 role=Slave
primitive exportfs_NW1 exportfs \
        params directory="/srv/nfs/NW1" options="rw,no_root_squash,crossmnt" clientspec="*" fsid=1 wait_for_leasetime_on_stop=true \
        op monitor interval=30s \
        op start interval=0 timeout=40 \
        op stop interval=0 timeout=120 \
        meta target-role=Started
primitive fs_NW1_sapmnt Filesystem \
        params device="/dev/drbd0" directory="/srv/nfs/NW1" fstype=ext4 \
        op monitor interval=10s
primitive nc_NW1_nfs anything \
        params binfile="/bin/netcat" cmdline_options="-l -k 61000"  \
        op monitor timeout=20s interval=10 depth=0
primitive nfsserver lsb:nfs-kernel-server \
        op monitor interval=30s
primitive stonith-sbd stonith:external/sbd \
        params pcmk_delay_max=15 \
        op monitor interval=15 timeout=15
primitive vip_NW1_nfs IPaddr2 \
        params ip= cidr_netmask=24 \
        op monitor interval=10 timeout=20
group g-NW1_nfs nfsserver vip_NW1_nfs fs_NW1_sapmnt exportfs_NW1 \
        meta target-role=Started
ms ms-drbd_NW1_nfs drbd_NW1_nfs \
        meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true interleave=true
colocation col-NW1_nfs_on_drbd inf: g-NW1_nfs ms-drbd_NW1_nfs:Master
order o-NW1_drbd_before_nfs inf: ms-drbd_NW1_nfs:promote g-NW1_nfs:start
property cib-bootstrap-options: \
        have-watchdog=false \
        dc-version=1.1.18-2b07d5c5a9 \
        cluster-infrastructure=corosync \
        cluster-name=NW1-nfs \
        stonith-enabled=true \
        no-quorum-policy=ignore \
        maintenance-mode=false \
rsc_defaults rsc-options: \