1. Introduction
This document describes how to use Oracle Clusterware 11gR2 for making MySQL instances highly-available. Oracle Clusterware is included in the Oracle Unbreakable Linux Basic Support package.
2. Simple overview
Oracle Clusterware is mainly used for clustering Oracle Databases (Real Application Clusters - RAC), but in can also be used for making other applications run in a clustered environments using custom scripts.
- All MySQL files, including RDBMS software and data directories are located in a clustered filesystem, accessible read-write from all cluster nodes.
- For each instance, there is a registered virtual IP resource in clusterware.
- Each instance is configured as a resource in clusterware with hard dependency to corresponding virtual IP resource.
- Clusterware calls configured actionscript for actions: start, stop, check, clean
3. Details
3.1. Filesystem overview
All the scripts are prepared keeping in mind, that all cluster nodes use shared storage and the same filesystem structure. Filesystem on shared storage should be mounted read-write on every node.
I have used OCFS2 clustered filesystem for all shared filesystems, but if you have a reliable NAS device, then using NFS is also an option.
3.1.1. Directory structure
The following directory structure is just a recommendation.
Basically there are two different types of filesystem mountpoints:
- Shared filesystem for MySQL software and clustering scripts. This requires very little space, 10-15 GB filesystem is enough. Also take into account that each version of 5.5 MySQL advanced edition tar-ball is over 600MB.
- Shared filesystem for MySQL instance data-directories. This would store the databases. I'd like to use a separate LUN/filesystem for each MySQL instance.
| /u02 | Mountpoint for software directory |
| /u02/app/mysql/ | Location for scripts |
| /u02/app/mysql/product/5.5.17/advanced | Location for MySQL RDBMS software version 5.5.17 advanced edition |
| /u02/app/mysql/product/5.5.16/advanced | Location for MySQL RDBMS software version 5.5.16 advanced edition |
| /u02/app/mysql/product/5.5.16/community | Location for MySQL RDBMS software version 5.5.16 community edition |
| /instance/instance_name | Mountpoint for MySQL data-directory filesystem |
| /instance/instance_name/config/my.cnf | mysqld configuration file for instance instance_name |
| /instance/instance_name/data | Data directory for MySQL instance instance_name |
| /instance/instance_name/logs | Error/general/slow logs for instance instance_name. Logs are rotated and archived by scripts automatically. |
3.1.2. Creating and mounting OCFS2 volumes
Creating ACFS filesystem for software:
-- todo
| /dev/mapper/mpath1 | Disk path (in this case using multipath) |
| -T mail | Filesystem template, mail is optimized for large number of small files; datafiles is optimized for small number of large files. |
| -N 8 | Maximum number of nodes |
| -L mysql_rdbms | Filesystem label |
Creating ACFS filesystem for MySQL instance data-directory:
-- todo
Resource dependencies to ACFS clusterware resource (ma ke sure mysql instance is stared after filesystems are mounted):
-- todo