Atom feed of this document
  
 

 Adding MySQL resources to Pacemaker

You may now proceed with adding the Pacemaker configuration for MySQL resources. Connect to the Pacemaker cluster with crm configure, and add the following cluster resources:

primitive p_ip_mysql ocf:heartbeat:IPaddr2 \
  params ip="192.168.42.101" cidr_netmask="24" \
  op monitor interval="30s"
primitive p_drbd_mysql ocf:linbit:drbd \
  params drbd_resource="mysql" \
  op start timeout="90s" \
  op stop timeout="180s" \
  op promote timeout="180s" \
  op demote timeout="180s" \
  op monitor interval="30s" role="Slave" \
  op monitor interval="29s" role="Master"
primitive p_fs_mysql ocf:heartbeat:Filesystem \
  params device="/dev/drbd/by-res/mysql" \
    directory="/var/lib/mysql" \
    fstype="xfs" \
    options="relatime" \
  op start timeout="60s" \
  op stop timeout="180s" \
  op monitor interval="60s" timeout="60s"
primitive p_mysql ocf:heartbeat:mysql \
  params additional_parameters="--bind-address=50.56.179.138"
    config="/etc/mysql/my.cnf" \
    pid="/var/run/mysqld/mysqld.pid" \
    socket="/var/run/mysqld/mysqld.sock" \
    log="/var/log/mysql/mysqld.log" \
  op monitor interval="20s" timeout="10s" \
  op start timeout="120s" \
  op stop timeout="120s"
group g_mysql p_ip_mysql p_fs_mysql p_mysql
ms ms_drbd_mysql p_drbd_mysql \
  meta notify="true" clone-max="2"
colocation c_mysql_on_drbd inf: g_mysql ms_drbd_mysql:Master
order o_drbd_before_mysql inf: ms_drbd_mysql:promote g_mysql:start

This configuration creates

  • p_ip_mysql, a virtual IP address for use by MySQL (192.168.42.101),
  • p_fs_mysql, a Pacemaker managed filesystem mounted to /var/lib/mysql on whatever node currently runs the MySQL service,
  • ms_drbd_mysql, the master/slave set managing the mysql DRBD resource,
  • a service group and order and colocation constraints to ensure resources are started on the correct nodes, and in the correct sequence.

crm configure supports batch input, so you may copy and paste the above into your live pacemaker configuration, and then make changes as required. For example, you may enter edit p_ip_mysql from the crm configure menu and edit the resource to match your preferred virtual IP address.

Once completed, commit your configuration changes by entering commit from the crm configure menu. Pacemaker will then start the MySQL service, and its dependent resources, on one of your nodes.

Questions? Discuss on ask.openstack.org
Found an error? Report a bug against this page

loading table of contents...