Skip to content

Cluster Active-Passive

This setup uses two servers (NAS1 and NAS2) with similar hardware and CentOS 7. It provides high-availability NFS storage using software RAID and DRBD 8. The configuration uses EnhanceIO disk cache with an Intel NVMe disk.

Network

NAS1 network device names

  • lan: Access interface
  • nas: NFS exported storage
  • drbd: Storage synchronization
cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="40:8d:5c:1e:0e:0c", ATTR{type}=="1", KERNEL=="e*", NAME="lan"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:36:9f:6e:18:c0", ATTR{type}=="1", KERNEL=="e*", NAME="nas"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:36:9f:6e:18:c2", ATTR{type}=="1", KERNEL=="e*", NAME="drbd"

NAS2 network device names

cat /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="40:8d:5c:1e:1c:54", ATTR{type}=="1", KERNEL=="e*", NAME="lan"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:36:9f:34:0a:c4", ATTR{type}=="1", KERNEL=="e*", NAME="nas"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="a0:36:9f:34:0a:c6", ATTR{type}=="1", KERNEL=="e*", NAME="drbd"

[root@nas2 network-scripts]# cat ifcfg-lan
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
NAME="lan"
ONBOOT="yes"
HWADDR="40:8d:5c:1e:1c:54"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"

IPADDR="192.0.2.32"
PREFIX="24"
GATEWAY="192.0.2.199"
DNS1="192.0.2.200"
DNS2="192.0.2.201"
DOMAIN="example.com"

[root@nas2 network-scripts]# cat ifcfg-nas
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="no"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
NAME="drbd"
ONBOOT="yes"
HWADDR=A0:36:9F:34:0A:C4
PEERDNS="no"
PEERROUTES="no"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"

IPADDR="198.51.100.32"
PREFIX="24"
MTU="9000"

[root@nas2 network-scripts]# cat ifcfg-drbd
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="no"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
NAME="drbd"
ONBOOT="yes"
HWADDR=A0:36:9F:34:0A:C6
PEERDNS="no"
PEERROUTES="no"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"

IPADDR="203.0.113.32"
PREFIX="24"
MTU="9000"

OS base installation

dnf update -y
vi /etc/hostname
dnf install ethtool pciutils fio smartmontools wget unzip tar mdadm net-tools

dnf install tuned
systemctl start tuned
systemctl enable tuned
tuned-adm profile throughput-performance

Command line for Intel NVMe & S3700

http://www.intel.com/support/ssdc/hpssd/sb/CS-035687.htm
wget https://downloadcenter.intel.com/downloads/eula/23931/Intel-Solid-State-Drive-Data-Center-Tool?httpDown=https%3A%2F%2Fdownloadmirror.intel.com%2F23931%2Feng%2FDataCenterTool_2_3_0_Linux.zip
unzip DataCenterTool_2_3_0_Linux.zip
rpm -Uvh isdct-2.3.0.400-13.x86_64.rpm

Sample commands to check NVMe

isdct show -intelssd
isdct show -sensor -intelssd 1

Initialize disks

dd if=/dev/zero of=/dev/sdb bs=4k count=1024
dd if=/dev/zero of=/dev/sdc bs=4k count=1024
dd if=/dev/zero of=/dev/sdd bs=4k count=1024
dd if=/dev/zero of=/dev/sde bs=4k count=1024
dd if=/dev/zero of=/dev/sdf bs=4k count=1024
dd if=/dev/zero of=/dev/sdg bs=4k count=1024
dd if=/dev/zero of=/dev/nvme0n1 bs=4k count=1024
partprobe

We could have used also: wipefs -a /dev/xxx

NTP Network time server

yum install ntp -y
systemctl start ntpd
systemctl status ntpd
systemctl enable ntpd

Hard Disks

The following lsblk output shows the current disk layout:

NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0  37,3G  0 disk
├─sda1            8:1    0   200M  0 part /boot/efi
├─sda2            8:2    0   500M  0 part /boot
└─sda3            8:3    0  36,6G  0 part
  ├─fedora-root 253:0    0  32,9G  0 lvm  /
  └─fedora-swap 253:1    0   3,7G  0 lvm  [SWAP]
sdb               8:16   0   2,7T  0 disk
sdc               8:32   0   2,7T  0 disk
sdd               8:48   0   1,8T  0 disk
sde               8:64   0   1,8T  0 disk
sdf               8:80   0 465,8G  0 disk
sdg               8:96   0  93,2G  0 disk
nvme0n1         259:0    0 372,6G  0 disk

Hard Disk Partitions

  • sdd and sde: 7200 rpm, 1.8 TB
  • sdb and sdc: 5400 rpm, 2.7 TB

The following scheme describes the storage architecture using RAID (md), LVM, and DRBD.

Note: Logical Volumes (LVs) are created both under and over DRBD. This allows resizing the underlying scheme and redistributing storage across DRBD. Storage is also split to enable moving resources between both nodes.

sdd1---\
        md1--\           /---lvgroups (md1)-------drbd30------vg_groups-------lv_groups
sde1---/      \         /
               vgdata--x-----lvtemplates----------drbd20------vg_templates----lv_templates
sdb1---\      /         \
        md2--/           \---lvbases--------------drbd10------vg_bases--------lv_bases
sdc1---/                  \
                           \-lvoldgroups----------drbd35------vg_oldgroups----lv_oldgroups


nvme0n1p1-\                 /--lv_cachegroups-----drbd31------vgcache_groups-----lvcache_groups
           \               /
sdf1--------x----vgcache--x----lv_cachetemplates--drbd21------vgcache_templates--lvcache_templates
           /               \
sdg1------/                 \--lv_cachebases------drbd11------vgcache_bases------lvcache_bases

And this is the cache over the previous layout:

lv_groups----------\
                    EnhanceIO:groups--------->/isard/groups
lvcache_groups-----/

lv_templates-------\
                    EnhanceIO:templates------>/isard/templates
lvcache_templates--/

lv_bases-----------\
                    EnhanceIO:bases---------->/isard/bases
lvcache_bases------/

Create Partitions

Leave a small partition at the beginning of the disks for I/O tests.

Use parted to check partition alignment:

print free
align-check opt 1

Create the partitions. Verify that the start sectors align with the beginning of a disk sector to maximize I/O performance. Check your disks using the previous commands.

parted /dev/sdb mklabel gpt
parted /dev/sdc mklabel gpt
parted /dev/sdd mklabel gpt
parted /dev/sde mklabel gpt
parted /dev/sdf mklabel gpt
parted /dev/sdg mklabel gpt
parted /dev/nvme0n1 mklabel gpt
parted -a optimal /dev/sdb mkpart primary ext4 4096s 2980G
parted -a optimal /dev/sdb mkpart primary ext4 2980G 100%
parted -a optimal /dev/sdc mkpart primary ext4 4096s 2980GB
parted -a optimal /dev/sdc mkpart primary ext4 2980GB 100%
parted -a optimal /dev/sdd mkpart primary ext4 4096s 1980GB
parted -a optimal /dev/sdd mkpart primary ext4 1980GB 100%
parted -a optimal /dev/sde mkpart primary ext4 4096s 1980GB
parted -a optimal /dev/sde mkpart primary ext4 1980GB 100%
parted -a optimal /dev/sdf mkpart primary ext4 2048s 495G
parted -a optimal /dev/sdf mkpart primary ext4 495GB 100%
parted -a optimal /dev/sdg mkpart primary ext4 512 94GB
parted -a optimal /dev/sdg mkpart primary ext4 94GB 99GB
parted -a optimal /dev/sdg mkpart primary ext4 99GB 100%
parted -a optimal /dev/nvme0n1 mkpart primary ext4 512 395GB
parted -a optimal /dev/nvme0n1 mkpart primary ext4 395GB 100%

reboot recommended

RAID

RAID provides the first level of redundancy for the system. Create a Level 1 RAID to achieve 2x read I/O speed and data duplication.

mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sdd1 /dev/sde1
mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
mdadm --detail --scan >> /etc/mdadm.conf

Non-clustered LVMs (local)

Device filtering

Configure the devices where LVM searches for LVM signatures.

filter = ["a|sd.*|", "a|nvme.*|", "a|md.*|", "a|drbd.*|", "r|.*|"]

PV/VG/LV scheme (under DRBD)

pvcreate /dev/md1
pvcreate /dev/md2

vgcreate -cn vgdata /dev/md1 /dev/md2
lvcreate -l 100%FREE -n lvgroups vgdata /dev/md1
lvcreate -L 1700G -n lvoldgroups vgdata /dev/md2
lvcreate -l 100%FREE -n lvtemplates vgdata /dev/md2

pvcreate /dev/nvme0n1p1
pvcreate /dev/sdf1
pvcreate /dev/sdg1
vgcreate vgcache /dev/nvme0n1p1 /dev/sdf1 /dev/sdg1
lvcreate -l 100%FREE -n lvcachebases vgcache /dev/sdg1
lvcreate -l 100%FREE -n lvcachetemplates vgcache /dev/sdg1
lvcreate -l 100%FREE -n lvcachegroups vgcache /dev/nvme0n1p1

DRBD

Install DRBD 8.

yum install drbd drbd-utils drbd-udev drbd-pacemaker -y
modprobe drbd
systemctl enable drbd

Create the drbd.conf and resource files.

DRBD config files

[root@nas1 ~]# 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";

[root@nas1 ~]# cat /etc/drbd.d/global_common.conf

# DRBD is the result of over a decade of development by LINBIT.
# In case you need professional services for DRBD or have
# feature requests visit http://www.linbit.com

global {
}

common {
        handlers {
                fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
                after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
        }

        startup {
        }

        options {
        }

        disk {
                #al-extents 3389;
                #disk-barrier no;
                #disk-flushes no;
                #fencing resource-and-stonith;
                fencing resource-only;
        }

        net {
                max-buffers 16000;
                max-epoch-size 16000;
                #unplug-watermark 16;
                #sndbuf-size 2048;
                allow-two-primaries;
                after-sb-0pri discard-zero-changes;
                after-sb-1pri discard-secondary;
                after-sb-2pri disconnect;
        }

        syncer {
         }
}

[root@nas1 ~]# cat /etc/drbd.d/bases.res

resource bases {
         startup {
                #become-primary-on both;
         }
        volume 0 {
                device    /dev/drbd11;
                disk      /dev/vgcache/lvcachebases;
                meta-disk internal;
        }

        volume 1 {
                device    /dev/drbd10;
                disk      /dev/vgdata/lvbases;
                meta-disk internal;
        }
    on nas1 {
         address   203.0.113.31:7810;
    }
    on nas2 {
         address   203.0.113.32:7810;
    }
}

[root@nas1 ~]# cat /etc/drbd.d/templates.res

resource templates {
         startup {
                #become-primary-on both;
         }
   volume 0 {
         device    /dev/drbd21;
         disk      /dev/vgcache/lvcachetemplates;
         meta-disk internal;
   }
   volume 1 {
         device    /dev/drbd20;
         disk      /dev/vgdata/lvtemplates;
         meta-disk internal;
   }
    on nas1 {
         address   203.0.113.31:7820;
    }
    on nas2 {
         address   203.0.113.32:7820;
    }
}

[root@nas1 ~]# cat /etc/drbd.d/groups.res

resource groups {
         startup {
                #become-primary-on both;
         }
        volume 0 {
                device    /dev/drbd31;
                disk      /dev/vgcache/lvcachegroups;
                meta-disk internal;
        }

        volume 1 {
                device    /dev/drbd30;
                disk      /dev/vgdata/lvgroups;
                meta-disk /dev/sdg3;
        }

        volume 2 {
                device    /dev/drbd35;
                disk      /dev/vgdata/lvoldgroups;
                meta-disk internal;
        }
    on nas1 {
         address   203.0.113.31:7830;
    }
    on nas2 {
         address   203.0.113.32:7830;
    }
}

Create the DRBD resources.

drbdadm create-md bases
drbdadm create-md templates
drbdadm create-md groups
drbdadm up bases
drbdadm up templates
drbdadm up groups
drbdadm primary bases --force
drbdadm primary templates --force
drbdadm primary groups --force

drbdadm disk-options --resync-rate=400M <resource>

LVM Nested volumes (now over DRBD)

Perform this LVM setup on only one node.

Groups

pvcreate /dev/drbd30
pvcreate /dev/drbd31
vgcreate vgcache_groups /dev/drbd31
lvcreate -l 100%FREE -n lvcache_groups vgcache_groups
lvcreate -l 100%FREE -n lvcache_templates vgcache_templates
vgcreate vg_groups /dev/drbd20
lvcreate -l 100%FREE -n lv_groups vg_groups
vgchange -ay vg_groups

Templates

pvcreate /dev/drbd20
pvcreate /dev/drbd21
vgcreate vgcache_templates /dev/drbd21
lvcreate -l 100%FREE -n lvcache_templates vgcache_templates
vgcreate vg_templates /dev/drbd20
lvcreate -l 100%FREE -n lv_templates vg_templates
vgchange -ay vg_templates

Bases

pvcreate /dev/drbd10
pvcreate /dev/drbd11
vgcreate vgcache_bases /dev/drbd11
lvcreate -l 100%FREE -n lvcache_bases vgcache_bases
vgcreate vg_bases /dev/drbd10
lvcreate -l 100%FREE -n lv_bases vg_bases
vgchange -ay vg_templates

OldGroups

pvcreate /dev/drbd35
vgcreate vg_oldgroups /dev/drbd35
lvcreate -l 100%FREE -n lv_oldgroups vg_oldgroups

Filesystem

mkfs.ext4 /dev/vg_bases/lv_bases
mkfs.ext4 /dev/vg_templates/lv_templates
mkfs.ext4 /dev/vg_groups/lv_groups
mkfs.ext4 /dev/vg_oldgroups/lv_oldgroups
Mount the LVM logical volumes to verify the configuration.

EnhanceIO Disk Cache

  1. Install the software:

    dnf install kernel-devel gcc
    git clone https://github.com/stec-inc/EnhanceIO.git
    cd EnhanceIO/Driver/enhanceio
    make && make install
    
    cd /root/EnhanceIO/CLI
    

  2. Apply the patch for kernels greater than 3:

    diff --git a/CLI/eio_cli b/CLI/eio_cli
    index 3453b35..a0b60c5 100755
    --- a/CLI/eio_cli
    +++ b/CLI/eio_cli
    @@ -1,4 +1,4 @@
    -#!/usr/bin/python
    +#!/usr/bin/python2
     #
     # Copyright (C) 2012 STEC, Inc. All rights not specifically granted
     # under a license included herein are reserved
    @@ -305,10 +305,12 @@ class Cache_rec(Structure):
    
            def do_eio_ioctl(self,IOC_TYPE):
                    #send ioctl to driver
    -               fd = open(EIODEV, "r")
    +               libc = CDLL('libc.so.6')
    +               fd = os.open (EIODEV, os.O_RDWR, 0400)
                    fmt = ''
    +               selfaddr = c_uint64(addressof(self))
                    try:
    -                       if ioctl(fd, IOC_TYPE, addressof(self)) == SUCCESS:
    +                       if libc.ioctl(fd, IOC_TYPE, selfaddr) == SUCCESS:
                                    return SUCCESS
                    except Exception as e:
                            print e
    

  3. Copy the binary to the path folder and install the modules in the kernel:

    cp EnhanceIO/CLI/eio_cli /sbin
    
    modprobe enhanceio
    modprobe enhanceio_fifo  x
    modprobe enhanceio_lru
    modprobe enhanceio_rand  x
    

  4. Install the modules persistently:

    vi /etc/modules-load.d/enhanceio.conf
        enhanceio
        enhanceio_lru
    

  5. To stop the cache device, set it to read-only and wait until all dirty sectors from the NVMe drive are written to the rotational hard disks.

    eio_cli edit -c data -m ro
    

Warning

Avoid kernel updates, as they will break EnhanceIO and you could lose all your data.

vi /etc/dnf/dnf.conf
    exclude=kernel*
  1. Create caches only on the primary DRBD node and copy the created udev rules to the other NAS (/etc/udev/rules.d/94...):

    eio_cli create -d /dev/vg_groups/lv_groups -s /dev/vgcache_groups/lvcache_groups -p lru -m wb -c groups
    eio_cli create -d /dev/vg_templates/lv_templates -s /dev/vgcache_templates/lvcache_templates -p lru -m wb -c templates
    eio_cli create -d /dev/vg_bases/lv_bases -s /dev/vgcache_bases/lvcache_bases -p lru -m wt -c bases
    

  2. Check the cache status:

    eio_cli info
    cat /proc/enhanceio/<cache_name>/stats
    

Pacemaker Cluster

Pacemaker monitors the resources and restarts them on the other node in case of failure.

dnf install corosync pacemaker pcs -y
systemctl enable pcsd; systemctl enable corosync; systemctl enable pacemaker;
systemctl start pcsd;
#passwd hacluster  (habitual)
pcs cluster auth nas1 nas2  (hacluster/habitual)
pcs cluster setup --name hvcluster nas1 nas2
pcs cluster start --all
pcs status

pcs property set default-resource-stickiness=200
pcs property set no-quorum-policy=ignore

To remove an existing cluster:

pcs cluster stop --all
pcs cluster destroy 
rm -rf /var/lib/pcsd/*
reboot

Fence agents

Install fence agents. A Pacemaker cluster requires a fencing device to function. This guide uses an APC STONITH device:

yum install python-pycurl fence-agents-apc fence-agents-apc-snmp -y

Fence agent (STONITH) Pacemaker resource definition:

pcs cluster cib fence_cfg
pcs -f fence_cfg stonith create stonith fence_apc_snmp params ipaddr=192.0.2.4 pcmk_host_list="nas1,nas2" pcmk_host_map="nas1:3;nas2:4" pcmk_host_check=static-list power_wait=5 inet4only debug=/var/log/stonith.log retry_on=10
pcs cluster cib-push fence_cfg

pcs property set stonith-enabled=true
pcs property set start-failure-is-fatal=false

DRBD resources

pcs cluster cib drbd_bases_cfg
pcs -f drbd_bases_cfg resource create drbd_bases ocf:linbit:drbd drbd_resource=bases op monitor interval=15s role=Master op monitor interval=30s role=Slave
pcs -f drbd_bases_cfg resource master drbd_bases-clone drbd_bases master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_bases_cfg

pcs cluster cib drbd_templates_cfg
pcs -f drbd_templates_cfg resource create drbd_templates ocf:linbit:drbd drbd_resource=templates op monitor interval=15s role=Master op monitor interval=30s role=Slave
pcs -f drbd_templates_cfg resource master drbd_templates-clone drbd_templates master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_templates_cfg

pcs cluster cib drbd_groups_cfg
pcs -f drbd_groups_cfg resource create drbd_groups ocf:linbit:drbd drbd_resource=groups op monitor interval=15s role=Master op monitor interval=30s role=Slave
pcs -f drbd_groups_cfg resource master drbd_groups-clone drbd_groups master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_groups_cfg

LVM resources

pcs resource create lv_bases ocf:heartbeat:LVM volgrpname=vg_bases op monitor interval=30s
pcs resource create lv_templates ocf:heartbeat:LVM volgrpname=vg_templates op monitor interval=30s
pcs resource create lv_groups ocf:heartbeat:LVM volgrpname=vg_groups op monitor interval=30s
pcs resource create lv_oldgroups ocf:heartbeat:LVM volgrpname=vg_oldgroups op monitor interval=30s
pcs resource create lvcache_bases ocf:heartbeat:LVM volgrpname=vgcache_bases op monitor interval=30s
pcs resource create lvcache_templates ocf:heartbeat:LVM volgrpname=vgcache_templates op monitor interval=30s
pcs resource create lvcache_groups ocf:heartbeat:LVM volgrpname=vgcache_groups op monitor interval=30s

Filesystem ext4 and mountpoints

pcs resource create ext4_bases Filesystem device="/dev/vg_bases/lv_bases" directory="/isard/bases" fstype="ext4" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s
pcs resource create ext4_templates Filesystem device="/dev/vg_templates/lv_templates" directory="/isard/templates" fstype="ext4" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s
pcs resource create ext4_groups Filesystem device="/dev/vg_groups/lv_groups" directory="/isard/groups" fstype="ext4" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s
pcs resource create ext4_oldgroups Filesystem device="/dev/vg_oldgroups/lv_oldgroups" directory="/isard/oldgroups" fstype="ext4" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s

NFS server

Version 4

NFS: server and root

pcs cluster cib nfsserver_cfg
pcs -f nfsserver_cfg resource create nfs-daemon systemd:nfs-server \
nfs_shared_infodir=/nfsshare/nfsinfo nfs_no_notify=true op monitor interval=30s \
--group nfs_server
pcs -f nfsserver_cfg resource create nfs-root exportfs \
clientspec=192.0.2.0/255.255.255.0 \
options=rw,crossmnt,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash \
directory=/isard \
fsid=0 \
--group nfs_server
pcs cluster cib-push nfsserver_cfg
pcs resource clone nfs_server master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 on-fail=restart notify=true resource-stickiness=0

NFS: Exports

pcs cluster cib exports_cfg
pcs -f exports_cfg resource create nfs_bases exportfs \
clientspec=192.0.2.0/255.255.255.0 \
wait_for_leasetime_on_stop=true \
options=rw,mountpoint,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/bases \
fsid=11 \
op monitor interval=30s

pcs -f exports_cfg resource create nfs_templates exportfs \
clientspec=192.0.2.0/255.255.255.0 \
wait_for_leasetime_on_stop=true \
options=rw,mountpoint,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/templates \
fsid=20 \
op monitor interval=30s

pcs -f exports_cfg resource create nfs_groups exportfs \
clientspec=192.0.2.0/255.255.255.0 \
wait_for_leasetime_on_stop=true \
options=rw,async,mountpoint,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/groups \
fsid=30 \
op monitor interval=30s

pcs -f exports_cfg resource create nfs_oldgroups exportfs \
clientspec=192.0.2.0/255.255.255.0 \
wait_for_leasetime_on_stop=true \
options=rw,async,mountpoint,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/oldgroups \
fsid=35 \
op monitor interval=30s
pcs cluster cib-push exports_cfg

Floating IPs

Floating IPs always move with their assigned resources.

pcs resource create IPbases ocf:heartbeat:IPaddr2 ip=198.51.100.210 cidr_netmask=32 nic=nas:0  op monitor interval=30 
pcs resource create IPtemplates ocf:heartbeat:IPaddr2 ip=198.51.100.211 cidr_netmask=32 nic=nas:0  op monitor interval=30 
pcs resource create IPgroups ocf:heartbeat:IPaddr2 ip=198.51.100.212 cidr_netmask=32 nic=nas:0 op monitor interval=30
pcs resource create IPvbases ocf:heartbeat:IPaddr2 ip=192.0.2.28 cidr_netmask=32 nic=lan:0 op monitor interval=30
pcs resource create IPvtemplates ocf:heartbeat:IPaddr2 ip=192.0.2.29 cidr_netmask=32 nic=lan:0 op monitor interval=30
pcs resource create IPvgroups ocf:heartbeat:IPaddr2 ip=192.0.2.30 cidr_netmask=32 nic=lan:0 op monitor interval=30

Groups and constraints

Groups allow you to start and stop resources in a specific order. Constraints allow you to define restrictions.

bases

pcs resource group add bases \
    lvcache_bases lv_bases ext4_bases nfs_bases IPbases IPvbases 

pcs constraint order \
    promote drbd_bases-clone then bases INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_drbd_bases

pcs constraint colocation add \
    bases with master drbd_bases-clone INFINITY \
    id=c_drbd_bases

pcs constraint order \
    nfs_server-clone then bases INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_nfs_bases

pcs constraint colocation add \
    bases with started nfs_server-clone INFINITY \
    id=c_nfs_bases

templates

pcs resource group add templates \
    lvcache_templates lv_templates ext4_templates nfs_templates IPtemplates IPvtemplates 

pcs constraint order \
    promote drbd_templates-clone then templates INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_drbd_templates

pcs constraint colocation add \
    templates with master drbd_templates-clone INFINITY \
    id=c_drbd_templates

pcs constraint order \
    nfs_server-clone then templates INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_nfs_templates

pcs constraint colocation add \
    templates with started nfs_server-clone INFINITY \
    id=c_nfs_templates

groups

pcs resource group add groups \
    lvcache_groups lv_groups lv_oldgroups ext4_groups ext4_oldgroups nfs_groups nfs_oldgroups IPgroups IPvgroups

pcs constraint order \
    promote drbd_groups-clone then groups INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_drbd_groups

pcs constraint colocation add \
    groups with master drbd_groups-clone INFINITY \
    id=c_drbd_groups

pcs constraint order \
    nfs_server-clone then groups INFINITY \
    require-all=true symmetrical=true \
    setoptions kind=Mandatory \
    id=o_nfs_groups

pcs constraint colocation add \
    groups with started nfs_server-clone INFINITY \
    id=c_nfs_groups

This constraint allows resources to be placed on a preferred node.

pcs constraint location lv_groups prefers nas2=50
pcs constraint location lv_oldgroups prefers nas2=50
pcs constraint location lv_bases prefers nas1=50
pcs constraint location lv_templates prefers nas1=50

Pacemaker utils

Manage and Unmanage Resources

To stop the cluster from managing a DRBD resource, unmanage it.

pcs resource unmanage drbd_templates-clone

To allow the cluster to manage a DRBD resource again, manage it.

pcs resource meta drbd_templates-clone is-managed=true

Resize volumes under DRBD

  1. Stop the cluster and start DRBD manually.
    pcs cluster stop/standby --all
    modprobe drbd
    
  2. Check that DRBD resources are not active (cat /proc/drbd).

CACHE: lvcachebases (ro), lvcachetemplates (wb), lvcachegroups (wb)

  1. Set the cache to read-only.

    eio_cli edit -c groups -m ro
    

  2. Wait until there are no dirty sectors (until the count is 0).

    grep nr_dirty /proc/enhanceio/groups/stats
    

  3. Remove the cache device.

    eio_cli delete -c groups
    

  4. For example, reduce lvcachegroups (600G: nvme0n1p1+/dev/sdf1) and grow lvcachetemplates to the new free space.

Shrink nvme0n1p1:

        lvreduce -L 100G /dev/vgcache/lvcachegroups
Grow nvme0n1p1:
        lvresize -l 100%FREE -n /dev/vgcache/lvcachegroups /dev/nvme0n1p1
Extend the template cache volume to the free space just created.
        lvextend -l +100%FREE /dev/vgcache/lvcachetemplates

drbd31 (resource groups, volume 0) will now be in the diskless state. This is normal, because the DRBD metadata inside the reduced volume was broken by the resize.

drbd21 (resource templates, volume 0) will now be synchronizing because it was grown, but it still has to be resized manually.

Apply the following to the reduced volumes:

wipefs -a /dev/vgcache/lvcachegroups
drbdadm create-md groups/0
drbdadm up groups
drbdadm invalidate-remote groups/0
You can now create the EnhanceIO groups cache again.

Apply the following to the grown volumes:

drbdadm resize templates/0
You can now create the EnhanceIO templates cache again.

To resize ext4 filesystems, use resize2fs.

Credits:

https://github.com/stec-inc/EnhanceIO https://www.suse.com/documentation/sle_ha/singlehtml/book_sleha_techguides/book_sleha_techguides.html https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Power_Management_Guide/ALPM.html