I decided to try to get more than an IP address clustered on my new OpenAIS setup. I was successful. I have two MySQL db nodes (db1, db2) running at 10.0.2.10[1,2]. Make sure you turn off all mysqld instances before proceeding…pacemaker will start/manage them for you.

# chmod a-x /etc/rc.d/rc.mysqld	(run on both nodes!)
# crm configure property no-quorum-policy="ignore"
# crm configure primitive ip_mysql ocf:heartbeat:IPaddr2 params ip="10.0.2.21"
# crm configure primitive mysqld \
	ocf:heartbeat:mysql \
	params binary="/usr/local/bin/mysqld_safe" \
	config="/etc/my.cnf" \
	socket="/srv/tmp/sockets/mysql.sock" \
	datadir="/srv/var/mysql" \
	user="mysql" \
	test_user="ha" \
	test_password="lololol" \
	test_table="beeets.omglolwtf" \
	op monitor interval="20s" timeout="20s" \
	meta migration-threshold="10" target-role="Started"
# crm configure group mysql mysqld ip_mysql

That should do it. Here’s a step-by-step:

  1. First, we turn off automatic execution of mysql on node startup. Since pacemaker will be managing mysql, we don’t want two instances conflicting.
  2. Turn off the quorum checking. Since we’re only running two nodes, it doesn’t make sense to stop all services if on of them goes down. In fact, that would sort of defeat the purpose.
  3. Add an IP address that will represent our MySQL cluster.
  4. Add the actual definition for MySQL. Obviously, you’ll be substituting your own values in for mine.
  5. Configure a group. Now MySQL will always run on the same machine as the ip_mysql (we want this!).

With this setup, you can contact MySQL at 10.0.2.21. A failure of db1 will result in db2 assimilating the 10.0.2.21 IP and the MySQL service. Pretty wicked. Next up, How this can relate to replication and/or DRBD.

Recently I read about compute clusters and how they’re used. I just had to try it. I successfully installed (from source) OpenAIS and Pacemaker (guide here) on Slackware 12. The experience was, overall, extremely smooth. I had a few hiccups I can only attribute to my not being able to follow directions, but with a few Makefile tweaks and some very small code tweaks, I got everything to compile and run.

Keep in mind, this is all using VirtualBox VMs, so once the cluster stuff is installed on one machine, I can more or less copy and paste and have a 3-computer linux cluster running from the comfort of Windows 7 (it’s just for games, I swear!!). Aside from having to mess a bit with the networking in VirtualBox, everything was almost completely automatic.

The next step is to figure out DRBD and how it fits in with all this HA stuff. I’ve been trying to find a guide on using Pacemaker with MySQL, but no guide is written JUST for MySQL…it’s all MySQL with DRBD. I’d rather not complicate things too much until I can figure out how the hell this is all working.

Anyway, I’ll report back with my findings sometime soon.

Please note – at the time of installing (about 6 or 7 days ago), there was a bug in the Debian packaged distribution of OpenAIS/Pacemaker that makes the “expected votes” value of the quorum formula > 3 billion. Unless you have 3 billion machines laying around, you will NOT be able to start any resources unless you configure to ignore the quorum. I’ve confirmed this bug on the IRC channel, and to my knowledge, it still exists.

My advice is to compile from source (but that’s always my advice anyway :) )