I'm setting up an HA cluster for a web application using two physical servers in a Corosync/Pacemaker managed cluster.
After finding out I was heading the wrong way, I decided to use heartbeat's bundled MySQL resource agent to manage my MySQL instances across the cluster.
Currently, there is a working master/slave configuration from
node1 (current master) to
node2 (current slave).
Now I would like Pacemaker to manage my MySQL instances so it can promote/demote master or slave.
According to this (old) wiki page, I should be able to achieve the setup by doing so:
primitive p_mysql ocf:heartbeat:mysql \ params binary="/usr/sbin/mysqld" \ op start timeout="120" \ op stop timeout="120" \ op promote timeout="120" \ op demote timeout="120" \ op monitor role="Master" timeout="30" interval="10" \ op monitor role="Slave" timeout="30" interval="20" ms ms_mysql p_mysql \ meta clone-max=3
As you can see, I did however change slightly the interval for the second
op monitor parameter, since I know Pacemaker identifies actions by Resource name (here,
p_mysql), action name, and interval. The interval was the only way to differentiate the monitor action on a slave node from the monitor action on a master node.
After committing the changes to the
CID and opening an interactive
crm_mon, I could see that Pacemaker failed to start the resource on every node. See attached screenshots:
Sorry cannot upload more than 2 links because I do not have enough reputation yet... Screenshots in comments
And it loops over and over, trying to set the current master to a slave, the current slave to a slave, then to a master... It is clearly looping and fails to instantiate properly MySQL instances.
For reference, my
crm configure show:
node 1: primary node 2: secondary primitive Failover ocf:onlinenet:failover \ params api_token=108efe5ee771368557869c7a837361a7c786f210 failover_ip=18.104.22.168 primitive WebServer apache \ params configfile="/etc/apache2/apache2.conf" statusurl="http://127.0.0.1/server-status" \ op monitor interval=40s \ op start timeout=40s interval=0 \ op stop timeout=60s interval=0 primitive p_mysql mysql \ params binary="/usr/sbin/mysqld" \ op start timeout=120 interval=0 \ op stop timeout=120 interval=0 \ op promote timeout=120 interval=0 \ op demote timeout=120 interval=0 \ op monitor role=Master timeout=30 interval=10 \ op monitor role=Slave timeout=30 interval=20 ms ms_mysql p_mysql \ meta clone-max=3 clone WebServer-clone WebServer colocation Failover-WebServer inf: Failover WebServer-clone property cib-bootstrap-options: \ dc-version=1.1.12-561c4cf \ cluster-infrastructure=corosync \ cluster-name=ascluster \ stonith-enabled=false \ no-quorum-policy=ignore