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:
- First, we turn off automatic execution of mysql on node startup. Since pacemaker will be managing mysql, we don’t want two instances conflicting.
- 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.
- Add an IP address that will represent our MySQL cluster.
- Add the actual definition for MySQL. Obviously, you’ll be substituting your own values in for mine.
- 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.
