Linux – Configuring resources for Galera and Corosync/Pacemaker

corosyncgaleralinuxpacemaker

I can't seem to find a proper way of setting up resources in pacemaker to manager my Galera cluster. I want a VIP that will failover betwen 5 boxes ( this works ), but I would also like to tie this into a resource that monitors mysql as well. If a mysql instance goes down, the VIP should move to another box that has mysql actually running. But I do not want pacemaker to start or stop the mysql service. Here is my current configuration:

node galera01
node galera02
node galera03
node galera04
node galera05
primitive ClusterIP IPaddr2 \
    params ip=10.10.10.178 cidr_netmask=24 \
    meta is-managed=true \
    op monitor interval=5s
primitive p_mysql mysql \
    params pid="/var/lib/mysql/mysqld.pid" test_user=root test_passwd=moo \
    meta is-managed=false \
    op monitor interval=5s OCF_CHECK_LEVEL=10 \
    op start interval=0 timeout=60s \
    op stop interval=0 timeout=60s on-fail=standby
group g_mysql p_mysql ClusterIP
order order_mysql_before_ip Mandatory: p_mysql ClusterIP
property cib-bootstrap-options: \
    dc-version=1.1.10-14.el6_5.3-368c726 \
    cluster-infrastructure="classic openais (with plugin)" \
    stonith-enabled=false \
    no-quorum-policy=ignore \
    expected-quorum-votes=5 \
    last-lrm-refresh=1401942846
rsc_defaults rsc-options: \
    resource-stickiness=100

What am I doing wrong?

Thank you.

Best Answer

So after much banging of my head on a table, our Percona contract finally kicked in again. Using a new HA resource : https://github.com/percona/percona-pacemaker-agents/raw/master/agents/mysql_monitor

Create the HA resource in its own folder , I called it Percona ( /usr/lib/ocf/resource.d/percona ). This resource will not try to kill your mysql nodes like the other one did.

Grab the pxc_resource_agent as well and place it in the same folder.

The new crm config is as follows:

node galera01 \
    attributes standby=off
node galera02 \
    attributes standby=off
node galera03 \
    attributes standby=off
node galera04 \
    attributes standby=off
node galera05 \
    attributes standby=off
primitive ClusterIP IPaddr2 \
    params ip=10.10.10.178 cidr_netmask=24 \
    meta is-managed=true \
    op monitor interval=5s
primitive p_mysql_monit ocf:percona:mysql_monitor \
    params reader_attribute=readable_monit writer_attribute=writable_monit user=root     password=foo pid="/var/lib/mysql/mysqld.pid" socket="/var/run/mysqld/mysqld.sock"   max_slave_lag=5 cluster_type=pxc \
    op monitor interval=1s timeout=20s OCF_CHECK_LEVEL=1
clone cl_mysql_monitor p_mysql_monit \
    meta clone-max=5 clone-node-max=1
location loc-no-writer-vip ClusterIP \
    rule $id="loc-no-writer-vip-rule" -inf: writable_monit eq 0
property cib-bootstrap-options: \
    dc-version=1.1.10-14.el6_5.3-368c726 \
    cluster-infrastructure="classic openais (with plugin)" \
    stonith-enabled=false \
    no-quorum-policy=ignore \
    expected-quorum-votes=5 \
    default-resource-stickiness=1
Related Topic