This is desirable as it can commit all changes in one atomic update.
Use the crm command prompt to do all configuration:
cib new sandbox
Sample Output:
node1:~# crm crm(live)# cib new sandbox INFO: sandbox shadow CIB created crm(sandbox)#
This helps to decide if a resource should not run when the node has lost external network connectivity. It does that by providing a pingd attribute so that others can check on it to know the connection status.
configure primitive net_conn ocf:pacemaker:ping \
params pidfile="/var/run/ping.pid" host_list="192.168.0.1" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="20s" \
op monitor interval="10s" timeout="60s"
# run this resource on both node:
configure clone clone_net_conn net_conn \
meta clone-node-max="1" clone-max="2"
One consistence IP address for the cluster regardless of which node is active or down.
configure primitive cluster_ip ocf:heartbeat:IPaddr2 \ params ip="192.168.0.100" cidr_netmask="32" \ op monitor interval="10s"
Don't run at the node which lost network connectivity:
this rsc will stick with the drbd master, so no need the config below:
# disabled: #configure location cluster_ip-no-conn cluster_ip \ # rule $id="cluster_ip-no-conn-rule" -inf: not_defined pingd or pingd number:lte 0
This just run the crm_mon program in daemon mode. It provides:
configure primitive cluster_mon ocf:pacemaker:ClusterMon \
params pidfile="/var/run/crm_mon.pid" \
htmlfile="/var/tmp/crm_mon.html" \
extra_options="-F ClusterMon@example.com --mail-to edp@example.com --mail-host smtp.example.com:25" \
op start interval="0" timeout="20s" \
op stop interval="0" timeout="20s" \
op monitor interval="10s" timeout="20s"
The foundation layer of the VE: the DRBD device.
# we name the resource as "drbd_r0" configure primitive drbd_r0 \ ocf:linbit:drbd params drbd_resource="r0" \ op start timeout="240s" \ op stop timeout="100s" \ op monitor role="Master" interval="11s" \ op monitor interval="10s" # we name the master/slave relation as "ms_drbd_r0" configure ms ms_drbd_r0 drbd_r0 \ meta master-max="1" master-node-max="1" \ clone-max="2" clone-node-max="1" notify="true" \ target-role="Started"
Don't run the master at the node which lost network connectivity:
configure location ms_drbd_r0-no-conn ms_drbd_r0 \ rule $id="ms_drbd_r0-no-conn-rule" $role="Master" -inf: \ not_defined pingd or pingd number:lte 0
Set node1 as the primary by preferring to run the DRBD Master on it:
configure location ms_drbd_r0-master-prefer-node1 ms_drbd_r0 \ rule role="Master" 50: #uname eq node1
This filesystem is mounted on the /dev/drbd0 device provide by the drbd_r0 resource.
The mount point is /vz.
configure primitive vz_fs ocf:heartbeat:Filesystem \ params device="/dev/drbd0" \ directory="/vz" \ fstype="ext3" \ op start timeout="60s" \ op stop timeout="60s" \ op monitor interval="10s" timeout="40s"
configure primitive vz_svc lsb:vz \ op monitor interval=10s
Assume the ID of the created VE is 1011.
configure primitive ve1011 ocf:heartbeat:ManageVE \ params veid=1011 \ op start timeout=240s \ op stop timeout=240s \ op monitor interval=10s
Don't run at the node which lost network connectivity:
configure location ve1011-no-conn ve1011 \
rule $id="ve1011-no-conn-rule" -inf: not_defined pingd or pingd number:lte 0
configure order ms_drbd_r0-b4-vz_fs inf: ms_drbd_r0:promote vz_fs:start configure order vz_fs-b4-vz_svc inf: vz_fs:start vz_svc:start configure order vz_svc-b4-ve1011 inf: vz_svc:start ve1011:start
Force these VE related resources to run together in the same node:
configure group group_vz vz_fs vz_svc ve1011 configure colocation coloc_vz inf: ms_drbd_r0:Master group_vz
Force the cluster management related resources to run together:
configure colocation coloc_mgmt inf: cluster_ip cluster_mon
Verify the configuration:
configure verify
If OK, commit the config to the live system:
cib commit sandbox
Execute at the shell:
crm << EOT
cib new sandbox
configure
primitive cluster_ip ocf:heartbeat:IPaddr2 \
params ip="192.168.0.100" cidr_netmask="32" \
op monitor interval="10s"
primitive cluster_mon ocf:heartbeat:ClusterMon \
params pidfile="/var/run/crm_mon.pid" htmlfile="/var/tmp/crm_mon.html" \
extra_options="-F ClusterMon@example.com --mail-to edp@example.com --mail-host smtp.example.com:25" \
op start interval="0" timeout="20s" \
op stop interval="0" timeout="20s" \
op monitor interval="10s" timeout="20s"
primitive drbd_r0 ocf:linbit:drbd \
params drbd_resource="r0" \
op start interval="0" timeout="240s" \
op stop interval="0" timeout="100s" \
op monitor interval="11s" role="Master" \
op monitor interval="10s"
primitive net_conn ocf:pacemaker:ping \
params pidfile="/var/run/ping.pid" host_list="192.168.0.1" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="20s" \
op monitor interval="10s" timeout="60s"
primitive ve1011 ocf:heartbeat:ManageVE \
params veid="1011" \
op start interval="0" timeout="240s" \
op stop interval="0" timeout="240s" \
op monitor interval="10s"
primitive vz_fs ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/vz" fstype="ext3" \
op start interval="0" timeout="60s" \
op stop interval="0" timeout="60s" \
op monitor interval="10s" timeout="40s"
primitive vz_svc lsb:vz \
op monitor interval="10s"
group group_vz vz_fs vz_svc ve1011
ms ms_drbd_r0 drbd_r0 \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true" target-role="Started"
clone clone_net_conn net_conn \
meta clone-node-max="1" clone-max="2"
location ms_drbd_r0-no-conn ms_drbd_r0 \
rule $id="ms_drbd_r0-no-conn-rule" $role="Master" -inf: not_defined pingd or pingd number:lte 0
location ms_drbd_r0-master-prefer-node1 ms_drbd_r0 \
rule $id="ms_drbd_r0-master-prefer-node1-rule" $role="Master" 50: #uname eq node1
location ve1011-no-conn group_vz \
rule $id="ve1011-no-conn-rule" -inf: not_defined pingd or pingd number:lte 0
colocation coloc_mgmt inf: cluster_ip cluster_mon
colocation coloc_vz inf: ms_drbd_r0:Master group_vz
order ms_drbd_r0-b4-vz_fs inf: ms_drbd_r0:promote group_vz:start
EOT
Verify and commit.
List installed resource agents:
crm ra list ocf heartbeat crm ra list ocf pacemaker