SQL-Group

pcs cluster cib sql_clust_cfg
pcs -f sql_clust_cfg resource create sql_drbd_res ocf:linbit:drbd \
  drbd_resource=sql \
  op monitor interval=30s
pcs -f sql_clust_cfg resource master SQLClone sql_drbd_res \
  master-max=1 master-node-max=1 \
  clone-max=2 clone-node-max=1 \
  notify=true
pcs -f sql_clust_cfg resource create sql_fs Filesystem \
  device="/dev/drbd1" \
  directory="/var/lib/mysql" \
  fstype="ext4"
pcs -f sql_clust_cfg resource create sql_service ocf:heartbeat:mysql \
  binary="/usr/bin/mysqld_safe" \
  config="/etc/my.cnf" \
  datadir="/var/lib/mysql" \
  pid="/var/lib/mysql/mysql.pid" \
  socket="/var/lib/mysql/mysql.sock" \
  additional_parameters="--bind-address=0.0.0.0" \
  op start timeout=60s \
  op stop timeout=60s \
  op monitor interval=20s timeout=30s
pcs -f sql_clust_cfg resource group add SQL-Group sql_fs sql_service
pcs -f sql_clust_cfg constraint order promote SQLClone then SQL-Group
pcs -f sql_clust_cfg constraint colocation add SQL-Group with SQLClone INFINITY with-rsc-role=Master
pcs -f sql_clust_cfg constraint location SQL-Group prefers node1
pcs -f sql_clust_cfg constraint

If it don't look EXACTLY like this, it won't work!

[root@node1 ~]# pcs -f sql_clust_cfg constraint
Location Constraints:
  Resource: SQL-Group
    Enabled on: node1 (score:INFINITY)
Ordering Constraints:
  promote SQLClone then start SQL-Group (kind:Mandatory)
Colocation Constraints:
  SQL-Group with SQLClone (score:INFINITY) (with-rsc-role:Master)
[root@node1 ~]#

Note: Everything up till now has been creating a file sql_clust_cfg, which you can check out. Its an XML breakdown which you can now or later push to your system. Once working save, the CIB!

pcs cluster cib-push sql_clust_cfg
pcs status