Active-Active Cluster¶
This setup uses two servers (hypervisor01 and hypervisor02) with similar hardware and software. It employs software RAID, DRBD 8 dual primary, Pacemaker cluster control, and the GFS2 cluster filesystem. The operating system is Fedora 22.
Networking¶
Rename interfaces
new_name=lan;
old_name=enp3s0;
echo SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", \
ATTR{address}==\"$(cat /sys/class/net/$old_name/address)\", \
ATTR{type}==\"1\", KERNEL==\"e*\", \
NAME=\"$new_name\" >> /etc/udev/rules.d/70-persistent-net.rules
new_name=drbd;
old_name=enp1s0;
echo SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", \
ATTR{address}==\"$(cat /sys/class/net/$old_name/address)\", \
ATTR{type}==\"1\", KERNEL==\"e*\", \
NAME=\"$new_name\" >> /etc/udev/rules.d/70-persistent-net.rules
new_name=dual0;
old_name=enp2s0f0;
echo SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", \
ATTR{address}==\"$(cat /sys/class/net/$old_name/address)\", \
ATTR{type}==\"1\", KERNEL==\"e*\", \
NAME=\"$new_name\" >> /etc/udev/rules.d/70-persistent-net.rules
new_name=dual1;
old_name=enp2s0f1;
echo SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", \
ATTR{address}==\"$(cat /sys/class/net/$old_name/address)\", \
ATTR{type}==\"1\", KERNEL==\"e*\", \
NAME=\"$new_name\" >> /etc/udev/rules.d/70-persistent-net.rules
Network interface configurations
[root@hypervisor01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-lan
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
ONBOOT="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
NAME="lan"
IPADDR="192.0.2.24"
PREFIX="24"
GATEWAY="192.0.2.199"
DNS1="192.0.2.200"
DNS2="192.0.2.201"
DOMAIN="example.com"
[root@hypervisor02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-lan
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
ONBOOT="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
NAME="lan"
IPADDR="192.0.2.25"
PREFIX="24"
GATEWAY="192.0.2.199"
DNS1="192.0.2.200"
DNS2="192.0.2.201"
DOMAIN="example.com"
[root@hypervisor01 ~]# cat /etc/sysconfig/network-scripts/ifcfg-drbd
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="no"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
ONBOOT="yes"
PEERDNS="no"
PEERROUTES="no"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
NAME="drbd"
IPADDR="203.0.113.24"
PREFIX="24"
MTU="9000"
[root@hypervisor02 ~]# cat /etc/sysconfig/network-scripts/ifcfg-drbd
TYPE="Ethernet"
BOOTPROTO="none"
DEFROUTE="no"
IPV4_FAILURE_FATAL="no"
IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
ONBOOT="yes"
PEERDNS="no"
PEERROUTES="no"
IPV6_PEERDNS="no"Tuneando fedora
IPV6_PEERROUTES="no"
NAME="drbd"
IPADDR="203.0.113.25"
PREFIX="24"
MTU="9000"
Partitioning and RAID¶
- 1 SSD for the OS
- 1 Intel high-end SSD (100 GB) to use as cache
- 3 hard disks (500 GB each) in RAID 1
Format disks and create partitions
parted -a optimal -s /dev/sda mklabel msdos
parted -a optimal -s /dev/sdc mklabel msdos
parted -a optimal -s /dev/sdd mklabel msdos
parted -a optimal -s /dev/sde mklabel msdos
[root@hypervisor01 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 93,2G 0 disk
sdb 8:16 0 55,9G 0 disk
├─sdb1 8:17 0 500M 0 part /boot
├─sdb2 8:18 0 5,6G 0 part [SWAP]
├─sdb3 8:19 0 33,5G 0 part /
├─sdb4 8:20 0 1K 0 part
└─sdb5 8:21 0 16,4G 0 part /home
sdc 8:32 0 931,5G 0 disk
sdd 8:48 0 931,5G 0 disk
sde 8:64 0 931,5G 0 disk
[root@hypervisor01 ~]# parted -s /dev/sdc print
Model: ATA TOSHIBA DT01ACA0 (scsi)
Disk /dev/sdc: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 500GB 500GB primary raid
Adjust SSD disk parameters¶
Disable swap and prevent updates to access times (noatime):
Update the fstab file:
Create raid 1¶
mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sdc1 /dev/sdd1 --spare-devices=1 /dev/sde1
cat /proc/mdstat
Create LVM cache (over RAID)¶
Volumes¶
Cache¶
vgextend vg_data /dev/sdb1
lvcreate -L 2G -n lv_cache_meta vg_data /dev/sdb1
lvcreate -L 88G -n lv_cache_data vg_data /dev/sdb1
lvcreate -l 100%FREE -n lv_data vg_data /dev/md0
lvconvert --yes --type cache-pool --cachemode writeback --poolmetadata vg_data/lv_cache_meta vg_data/lv_cache_data
lvconvert --type cache --cachepool vg_data/lv_cache_data vg_data/lv_data
lsblk
lvdisplay
lvdisplay -a
Fedora tuning¶
Firewall¶
Selinux¶
setenforce 0
sed -i s/SELINUX=enforcing/SELINUX=permissive/ /etc/sysconfig/selinux
sed -i s/SELINUX=enforcing/SELINUX=permissive/ /etc/selinux/config
sestatus
Package utilities¶
Network Time Protocol¶
Bash history tuning¶
cat >> .bashrc << "EOF"
# bash_history infinite
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Avoid duplicates
export HISTCONTROL=ignoredups:erasedups
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend
# After each command, append to the history file and reread it
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
alias history_cleaned="cat .bash_history |grep -a -v ^'#'"
export TMOUT=3600
EOF
DRBD 8¶
Install packages¶
Configuration files¶
Retrieve the sample configuration files from the installed packages:
cp -a /etc/drbd.conf /root/drbd.conf.dist.f22
cp -a /etc/drbd.d/global_common.conf /root/drbd_global_common.conf.dist.f22
Configure drbd.conf:
global {
usage-count yes;
}
common {
handlers {
}
startup {
}
options {
}
disk {
}
net {
protocol C;
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
}
Define the resources in /etc/drbd.d/vdisks.res:
resource vdisks {
device /dev/drbd0;
disk /dev/vg_data/lv_data;
meta-disk internal;
on hypervisor01 {
address 203.0.113.24:7789;
}
on hypervisor02 {
address 203.0.113.25:7789;
}
}
Create the DRBD metadata:
drbdadm create-md vdisks
[...]
Writing meta data...
New drbd meta data block successfully created.
success
Run a dry-run adjustment to validate the configuration files:
Apply the configuration:
Verify the status on both servers:
[root@hypervisor01 ~]# cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 5A4F43804B37BB28FCB1F47
0: cs:Connected ro:Secondary/Secondary ds:Inconsistent/Inconsistent C r-----
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:488236452
Force the primary role on one server (hypervisor01):
Repeat the process on the other server (hypervisor02) to establish a dual-primary configuration:
drbdadm primary vdisks
[root@hypervisor01 ~]# cat /proc/drbd
version: 8.4.5 (api:1/proto:86-101)
srcversion: 5A4F43804B37BB28FCB1F47
0: cs:SyncSource ro:Primary/Primary ds:UpToDate/Inconsistent C r-----
ns:17322104 nr:0 dw:0 dr:17323016 al:0 bm:0 lo:2 pe:2 ua:2 ap:0 ep:1 wo:f oos:470916516
[>....................] sync'ed: 3.6% (459876/476792)M
finish: 3:03:06 speed: 42,844 (36,616) K/sec
Cluster¶
Install Pacemaker packages¶
Fence agents
Pacemaker
Pacemaker DRBD resource
Packages required for the GFS2 filesystem (it requires cluster lock control)
Starting and configuring the cluster¶
Configure host name resolution in /etc/hosts.
hypervisor01:
echo "hypervisor01" > /etc/hostname
echo "192.0.2.24 hypervisor01" >> /etc/hosts
echo "192.0.2.25 hypervisor02" >> /etc/hosts
exit
hypervisor02:
echo "192.0.2.24 hypervisor01" >> /etc/hosts
echo "192.0.2.25 hypervisor02" >> /etc/hosts
echo "hypervisor02" > /etc/hostname
exit
Perform the following steps on one node only:
server1=hypervisor01
server2=hypervisor02
cl_name=hvcluster
pcs cluster auth $server1 $server2
pcs cluster setup --name $cl_name $server1 $server2
pcs cluster start --all
pcs status
[root@hypervisor01 ~]# pcs status
Cluster name: hvcluster
WARNING: no stonith devices and stonith-enabled is not false
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Last updated: Sun Oct 25 23:37:34 2015 Last change:
Stack: unknown
Current DC: NONE
0 nodes and 0 resources configured
Full list of resources:
PCSD Status:
hypervisor01 member (hypervisor01): Online
hypervisor02 member (hypervisor02): Online
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Verify that the cluster configuration loads as expected.
[root@hypervisor01 ~]# pcs cluster cib |grep hypervisor
<cib crm_feature_set="3.0.10" validate-with="pacemaker-2.3" epoch="5" num_updates="8" admin_epoch="0" cib-last-written="Sun Oct 25 23:52:24 2015" update-origin="hypervisor02" update-client="crmd" update-user="hacluster" have-quorum="1" dc-uuid="2">
<nvpair id="cib-bootstrap-options-cluster-name" name="cluster-name" value="hvcluster"/>
<node id="1" uname="hypervisor01"/>
<node id="2" uname="hypervisor02"/>
<node_state id="2" uname="hypervisor02" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
<node_state id="1" uname="hypervisor01" in_ccm="true" crmd="online" crm-debug-origin="do_state_transition" join="member" expected="member">
[root@hypervisor01 ~]# grep hypervisor /etc/corosync/corosync.conf
cluster_name: hvcluster
ring0_addr: hypervisor01
ring0_addr: hypervisor02
Fencing¶
[root@hypervisor01 ~]# pcs stonith list
fence_apc - Fence agent for APC over telnet/ssh
fence_apc_snmp - Fence agent for APC, Tripplite PDU over SNMP
Verify that your STONITH device is reachable and functional:
fence_apc_snmp --ip=stonith1 --action=monitor
fence_apc_snmp --ip=stonith1 --action=monitor --community=<community>
fence_apc_snmp --ip=stonith1 --action=reboot --plug=6 --community=<community> --power-wait=5
Configure the STONITH resource as SSH (discarded because it is too slow):
#pwd1=$(cat /root/pwd1)
#pwd2=$(cat /root/pwd2)
pcs stonith delete stonith1
pcs cluster cib stonith_cfg
pcs -f stonith_cfg stonith create stonith1 fence_apc ipaddr=192.0.2.3 login=<user> passwd=$pwd1 pcmk_host_list="hypervisor01 hypervisor02" pcmk_host_map="hypervisor01:4;hypervisor02:5"
#pcs -f stonith_cfg stonith create stonith2 fence_apc ipaddr=192.0.2.3 login=<user> passwd=$pwd2 pcmk_host_list="hypervisor02" pcmk_host_map="hypervisor02:3"
pcs -f stonith_cfg property set stonith-enabled=false
pcs cluster cib-push stonith_cfg
Configure the STONITH resource as SNMP (the one used in this setup):
pcs stonith delete stonith1
pcs cluster cib stonith_cfg
pcs -f stonith_cfg stonith create stonith1 fence_apc_snmp params ipaddr=192.0.2.3 pcmk_host_list="hypervisor01,hypervisor02" pcmk_host_map="hypervisor01:4;hypervisor02:5" pcmk_host_check=static-list power_wait=5
pcs cluster cib-push stonith_cfg
Activate the STONITH resource:
Run tests (warning: this will reboot nodes!):
You can disable fencing while configuring the cluster:
Check the STONITH resource definition:
Find logs in:
PACEMAKER DRBD¶
echo drbd > /etc/modules-load.d/drbd.conf
pcs resource create drbd-vdisks ocf:linbit:drbd drbd_resource=vdisks op monitor interval=60s
pcs resource master drbd-vdisks-clone drbd-opt master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
dlm¶
Cluster locking is required for the GFS2 filesystem.
pcs cluster cib dlm_cfg
pcs -f dlm_cfg resource create dlm ocf:pacemaker:controld op monitor interval=60s
pcs -f dlm_cfg resource clone dlm clone-max=2 clone-node-max=1
pcs cluster cib-push dlm_cfg
Cluster LVM¶
Set up cluster LVMs¶
systemctl disable lvm2-lvmetad.service
systemctl disable lvm2-lvmetad.socket
systemctl stop lvm2-lvmetad.service
lvmconf --enable-cluster
reboot
Define the devices where LVM looks for LVM signatures in the /etc/lvm/lvm.conf file:
Set up cluster lock LVMs¶
pcs cluster cib clvmd_cfg
pcs -f clvmd_cfg resource create clvmd ocf:heartbeat:clvm params daemon_options="timeout=30s" op monitor interval=60s
pcs -f clvmd_cfg resource clone clvmd clone-max=2 clone-node-max=1
pcs cluster cib-push clvmd_cfg
Verify the cluster status:
[root@hypervisor02 ~]# pcs status
Cluster name: hvcluster
WARNING: corosync and pacemaker node names do not match (IPs used in setup?)
Last updated: Thu Oct 29 13:14:58 2015 Last change: Thu Oct 29 13:14:42 2015 by root via cibadmin on hypervisor02
Stack: corosync
Current DC: hypervisor02 (version 1.1.13-3.fc22-44eb2dd) - partition with quorum
2 nodes and 7 resources configured
Online: [ hypervisor01 hypervisor02 ]
Full list of resources:
Master/Slave Set: drbd-vdisks-clone [drbd-vdisks]
Masters: [ hypervisor01 hypervisor02 ]
stonith1 (stonith:fence_apc_snmp): Started hypervisor01
Clone Set: dlm-clone [dlm]
Started: [ hypervisor01 hypervisor02 ]
Clone Set: clvmd-clone [clvmd]
Started: [ hypervisor01 hypervisor02 ]
PCSD Status:
hypervisor01 member (hypervisor01): Online
hypervisor02 member (hypervisor02): Online
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
Create volumes¶
On each server:
Use the -ci flag for cluster actions:
Now you can continue with cluster-wide commands:
Check on the other node if the volume group was created:
[root@hypervisor02 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg_data 2 1 0 wz--n- 558,79g 1,16g
vgcluster 1 0 0 wz--nc 465,62g 465,62g
Keep some free space in case you want to run I/O tests:
Check it from the other server:
[root@hypervisor01 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_data vg_data Cwi-aoC--- 465,63g [lv_cache_data] [lv_data_corig] 0,00 0,82 0,00
lvcluster1 vgcluster -wi-a----- 451,65g
Running fencing from DRBD¶
Add the following to the handlers section in /etc/drbd.d/global_common.conf:
fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
Add the following to the disk section:
The result is:
[root@hypervisor01 ~]# cat /etc/drbd.d/global_common.conf
global {
usage-count yes;
}
common {
handlers {
split-brain "/usr/lib/drbd/notify-split-brain.sh root";
fence-peer "/usr/lib/drbd/crm-fence-peer.sh";
after-resync-target "/usr/lib/drbd/crm-unfence-peer.sh";
}
startup {
}
options {
}
disk {
fencing resource-and-stonith;
}
net {
protocol C;
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
}
}
Verify that Pacemaker and STONITH are working:
[root@hypervisor01 ~]# pcs property list
Cluster Properties:
cluster-infrastructure: corosync
cluster-name: hvcluster
dc-version: 1.1.13-3.fc22-44eb2dd
have-watchdog: false
stonith-enabled: true
Confirm that STONITH is enabled:
Constraints¶
Start dlm and clvmd in the following order:
pcs cluster cib constraints_cfg
pcs constraint order set drbd-vdisks-clone action=promote \
set dlm-clone clvmd-clone action=start \
sequential=true
pcs cluster cib-push constraints_cfg
DRBD¶
The following is a sample DRBD configuration for a GFS2 cluster.
Create the DRBD resources in /etc/drbd.d/.
drbdadm create-md bases
drbdadm create-md templates
drbdadm create-dm grups
drbdadm up bases
drbdadm up templates
drbdadm up grups
drbdadm primary bases --force
drbdadm primary templates --force
drbdadm primary grups --force
dlm and clvm2 resources¶
Clustered LVMs
pcs cluster cib locks_cfg
pcs -f locks_cfg resource create dlm ocf:pacemaker:controld op monitor interval=60s --group cluster_lock
pcs -f locks_cfg resource create clvmd ocf:heartbeat:clvm params daemon_options="timeout=30s" op monitor interval=60s --group cluster_lock
pcs -f locks_cfg resource clone cluster_lock clone-max=2 clone-node-max=1 on-fail=restart
pcs cluster cib-push locks_cfg
Non-clustered LVMs
pcs resource create dlm ocf:pacemaker:controld op monitor interval=60s
pcs resource clone dlm clone-max=2 clone-node-max=1 on-fail=restart
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=60s
pcs -f drbd_bases_cfg resource master drbd_bases-clone drbd_bases master-max=2 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=60s
pcs -f drbd_templates_cfg resource master drbd_templates-clone drbd_templates master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_templates_cfg
pcs cluster cib drbd_grups_cfg
pcs -f drbd_grups_cfg resource create drbd_grups ocf:linbit:drbd drbd_resource=grups op monitor interval=60s
pcs -f drbd_grups_cfg resource master drbd_grups-clone drbd_grups master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
pcs cluster cib-push drbd_grups_cfg
GFS2 filesystem¶
mkfs.gfs2 -p lock_dlm -t hvcluster:bases -j 2 /dev/drbd10
mkfs.gfs2 -p lock_dlm -t hvcluster:templates -j 2 /dev/drbd11
mkfs.gfs2 -p lock_dlm -t hvcluster:grups -j 2 /dev/drbd30
GFS2 resources¶
pcs resource create gfs2_bases Filesystem device="/dev/drbd10" directory="/isard/bases" fstype="gfs2" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s on-fail=restart clone clone-max=2 clone-node-max=1
pcs resource create gfs2_templates Filesystem device="/dev/drbd11" directory="/isard/templates" fstype="gfs2" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s on-fail=restart clone clone-max=2 clone-node-max=1
pcs resource create gfs2_grups Filesystem device="/dev/drbd30" directory="/isard/grups" fstype="gfs2" "options=defaults,noatime,nodiratime,noquota" op monitor interval=10s on-fail=restart clone clone-max=2 clone-node-max=1
NFS 4 server¶
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 \
--group nfs_server
pcs -f nfsserver_cfg resource create nfs-root exportfs \
clientspec=192.0.2.0/255.255.255.0 \
options=rw,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 4 exports¶
pcs cluster cib exports_cfg
pcs -f exports_cfg resource create nfs_bases exportfs \
clientspec=192.0.2.0/255.255.255.0 \
options=rw,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/bases \
fsid=11 \
clone master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 on-fail=restart notify=true resource-stickiness=0
pcs -f exports_cfg resource create nfs_templates exportfs \
clientspec=192.0.2.0/255.255.255.0 \
options=rw,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/templates \
fsid=21 \
clone master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 on-fail=restart notify=true resource-stickiness=0
pcs -f exports_cfg resource create nfs_grups exportfs \
clientspec=192.0.2.0/255.255.255.0 \
options=rw,async,wdelay,no_root_squash,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash directory=/isard/grups \
fsid=31 \
clone master-max=2 master-node-max=1 clone-max=2 clone-node-max=1 on-fail=restart notify=true resource-stickiness=0
pcs cluster cib-push exports_cfg
Floatin IPs¶
pcs resource create ClusterIPbases ocf:heartbeat:IPaddr2 ip=198.51.100.210 cidr_netmask=32 nic=nas:10 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
pcs resource create ClusterIPtemplates ocf:heartbeat:IPaddr2 ip=198.51.100.211 cidr_netmask=32 nic=nas:11 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
pcs resource create ClusterIPgrups ocf:heartbeat:IPaddr2 ip=198.51.100.212 cidr_netmask=32 nic=nas:30 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
pcs resource create ClusterIPcnasbases ocf:heartbeat:IPaddr2 ip=192.0.2.28 cidr_netmask=32 nic=nas:110 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
pcs resource create ClusterIPcnastemplates ocf:heartbeat:IPaddr2 ip=192.0.2.29 cidr_netmask=32 nic=nas:111 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
pcs resource create ClusterIPcnasgrups ocf:heartbeat:IPaddr2 ip=192.0.2.30 cidr_netmask=32 nic=nas:130 clusterip_hash=sourceip-sourceport-destport meta resource-stickiness=0 op monitor interval=5 clone globally-unique=true clone-max=2 clone-node-max=2 on-fail=restart resource-stickiness=0
Constraints¶
Start and stop order and restrictions
pcs constraint order \
set stonith action=start \
set cluster_lock-clone action=start \
set nfs_server-clone action=start \
require-all=true sequential=true \
setoptions kind=Mandatory id=serveis
pcs constraint order \
set drbd_bases-clone action=promote role=Master \
set gfs2_bases-clone \
set nfs_bases-clone \
set ClusterIPcnasbases-clone action=start \
set ClusterIPbases-clone action=start \
require-all=true sequential=true \
setoptions kind=Mandatory id=bases
pcs constraint order \
set drbd_templates-clone action=promote role=Master \
set gfs2_templates-clone \
set nfs_templates-clone \
set ClusterIPcnastemplates-clone action=start \
set ClusterIPtemplates-clone action=start \
require-all=true sequential=true \
setoptions kind=Mandatory id=templates
pcs constraint order \
set drbd_grups-clone action=promote role=Master \
set gfs2_grups-clone \
set nfs_grups-clone \
set ClusterIPcnasgrups-clone action=start \
set ClusterIPgrups-clone action=start \
require-all=true sequential=true \
setoptions kind=Mandatory id=grups
Location constraints
pcs constraint colocation add \
ClusterIPbases-clone with nfs_bases-clone INFINITY \
id=colocate_bases
pcs constraint colocation add \
ClusterIPtemplates-clone with nfs_templates-clone INFINITY \
id=colocate_templates
pcs constraint colocation add \
ClusterIPgrups-clone with nfs_grups-clone INFINITY \
id=colocate_grups
pcs constraint colocation add \
ClusterIPcnasbases-clone with nfs_bases-clone INFINITY \
id=colocate_cnasbases
pcs constraint colocation add \
ClusterIPcnastemplates-clone with nfs_templates-clone INFINITY \
id=colocate_cnastemplates
pcs constraint colocation add \
ClusterIPcnasgrups-clone with nfs_grups-clone INFINITY \
id=colocate_cnasgrups