Clustered NFS/Samba

- NFS/Samba on Pacemaker and DRBD

testbox1:~ # cat /etc/drbd.conf 
# You can find an example in /usr/share/doc/drbd.../drbd.conf.example include "drbd.d/global_common.conf";
include "drbd.d/*.res";
 
resource nfs_replica {
meta-disk internal;
device /dev/drbd1;
syncer {
verify-alg sha1;
}
on testbox1 {
disk /dev/mapper/vg_nfs_exports-lv_nfs_exports; address 10.x.x.x:7788; }
on testbox2 {
disk /dev/mapper/vg_nfs_exports-lv_nfs_exports; address 10.x.x.x:7788; }
}

testbox1:~ # crm configure show
node 168496139: testbox2
node 168496142: testbox1
primitive DRBD_NFS_EXPORTS ocf:linbit:drbd \
params drbd_resource=nfs_replica \
op monitor interval=30 role=Slave \
op monitor interval=29 role=Master
primitive FILESYSTEM_EXPORTS Filesystem \
params device="/dev/drbd1" directory="/srv/exports" fstype=xfs
primitive NFS_SERVER systemd:nfs-server \
op monitor interval=30primitive NMB_SERVER systemd:nmb \
op monitor interval=30primitive SMB_SERVER systemd:smb \
op monitor interval=30primitive STONITH_NODE1_FENCE stonith:external/ssh \
params hostlist=testbox1 \
op monitor interval=25 timeout=20
primitive STONITH_NODE2_FENCE stonith:external/ssh \
params hostlist=testbox2 \
op monitor interval=25 timeout=20primitive VIP IPaddr2 \
params ip=10.x.x.x \
op monitor interval=10 timeout=20
group TEST_RG VIP FILESYSTEM_EXPORTS NFS_SERVER SMB_SERVER NMB_SERVER
ms DRBD_NFS_EXPORTS_CLONE DRBD_NFS_EXPORTS \
meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
colocation C_RG_on_DRBD inf: TEST_RG DRBD_NFS_EXPORTS_CLONE:Master
location L_STONITH_NODE1_FENCE STONITH_NODE1_FENCE inf: testbox1
location L_STONITH_NODE2_FENCE STONITH_NODE2_FENCE inf: testbox2
property cib-bootstrap-options: \
have-watchdog=false \
dc-version="1.1.18+20180430.b12c320f5-1.2-b12c320f5" \
cluster-infrastructure=corosync \
cluster-name=testcluster \
stonith-enabled=true \
no-quorum-policy=ignore \
placement-strategy=balanced \
last-lrm-refresh=1530863933 \
stonith-action=reboot
rsc_defaults rsc-options: \
resource-stickiness=100 \
migration-threshold=3
op_defaults op-options: \
timeout=600 \
record-pending=true


testbox1:~ # crm status && printf "DRBD status:\n\n" && drbd-overview 2> /dev/null
Stack: corosync
Current DC: testbox1 (version 1.1.18+20180430.b12c320f5-1.2-b12c320f5) - partition with quorum
Last updated: Fri Jul 6 11:21:45 2018
Last change: Fri Jul 6 09:52:15 2018 by root via cibadmin on testbox1

2 nodes configured
9 resources configured

Online: [ testbox1 testbox2 ]

Full list of resources:
STONITH_NODE1_FENCE (stonith:external/ssh): Started testbox1
STONITH_NODE2_FENCE (stonith:external/ssh): Started testbox2
Resource Group: TEST_RG
VIP        (ocf::heartbeat:IPaddr2): Started testbox1
FILESYSTEM_EXPORTS (ocf::heartbeat:Filesystem): Started testbox1
NFS_SERVER (systemd:nfs-server): Started testbox1
SMB_SERVER (systemd:smb): Started testbox1
NMB_SERVER (systemd:nmb): Started testbox1
Master/Slave Set: DRBD_NFS_EXPORTS_CLONE [DRBD_NFS_EXPORTS]
Masters: [ testbox1 ]
Slaves: [ testbox2 ]

DRBD status:
 
1:nfs_replica/0 Connected(2*) Primar/Second UpToDa/UpToDa /srv/exports xfs 25G 4.3G 21G 18%