The Project

The MyCAT project is an open-source toolset for managing MySQL/Linux servers, and could be helpful for anyone managing a network of *nix servers, whether running MySQL Cluster, "standard" replication, or not running MySQL at all.

rep_mon and binlog_mon are the MySQL-centric aspects of MyCAT, though one more (dbbk) is planned. rep_mon compares the binary log positions in any replication topology to validate that all your slaves are up to date and that there have been no problems. binlog_mon monitors disk space usage of your master server's binary logs, rotating (purging) only when necessary.

The tool rcall is a blessing to sysadmins whether or not MySQL is installed on a server: it makes trivial the task of answering, "what version of software X is installed on all my servers?" Similarly, sending a new httpd.conf and restarting apache across 30 web servers is as simple as running two commands on one server and watching the status reports roll in.

Two other tools are planned, but currently ugly and unwieldly and so are not included in the download package. When I have the time to update them, they will get included here.

The Perl package is available at http://sourceforge.net/projects/mycat/. Installation follows the usual means:

* tar -xzvf Mycat-$release.tar.gz
* cd Mycat-$release
* perl Makefile.PL
* make
* make install

BINLOG_MON

Monitor the disk space used by a MySQL replicatiom master's binary logs, and PURGE the oldest file when specified disk usage limits are exceeded. This can be configured to purge logs when total used kB on a volume is greater than a limit, when the % used is above a limit, or when total free kB is below a limit. Binlog_mon also verifies that no replication slaves are still reading each binary log before deleting it. Additionally, binlog_mon has a second "critical" threshhold. Should a master server's disk exceed this critical threshold, binlog_mon *can* delete binary log files to prevent the disk from filling up -- if configured to do so. By default, this would be considered an error state, since it will most likely corrupt your slaves, so binlog_mon will send an email immediately notifying you what happened. It can be configured to simply send an email, instead of deleting still-needed files.

REP_MON

Checks/verifies the status of replication between any number of servers in any variety of configurations: master->slave, master-> many slaves, round robin (A->B->C-A), etc. This script can be run as a cron, to send an email or page if any errors are detected.

RCALL

Tool to ease use and administration of groups (clusters) of *nix servers by creating logical groupings and a single location from which to run commands on all servers (while entering it only once). rcall requires that SSH key-based (passwordless) logins be previously set up across the servers to function properly. There is a great chapter on setting this up in 'Linux Server Hacks' by O'Reilly press, also viewable online at http://hacks.oreilly.com/pub/h/66. Rcall now has the ability to "scp" files from the local host to configured groups of servers, just as it would run a command on them.

ABOUT

MyCAT is developed and maintained by Devananda van der Veen. Initially developed as completely separate tools to automate daily tasks, it became apparent that these tools would benefit from being combined into a cohesive package and could be useful to other Linux and MySQL admins.

PLANS

I would like to include two additional scripts I wrote and use, however they are not currently in a good state.

conftool
* stores server-specific configuration files (ie, my.cnf, httpd.conf, etc) from all servers on a network in a single place
* facilitates easy modification of many server's configuration at once
* used with rcall, makes even easier the task of reconfiguring and restarting processes across many servers (ie.: httpd processes in large web farm)

dbbk
* backs up mysql data to disk
* compresses and rotates backup files, deleting oldest only when space needed
* scheduling possible through per-table rules, allowing wildcards
* records number of rows saved and time taken per table (useful for growth metrics)