NAME

Mysql::Replication


SYNOPSIS

handy tools to manage replicated MySQL servers.


DESCRIPTION

I have several clusters of replicated MySQL clusters that I manage. Some are geographically redundant, some are used strictly for load balancing. This script is VERY useful for me and my co-workers. It allows you to set up replication, monitor it, periodic maintenance (log pruning, etc), and backups.

I have since broken mysql_replicate_manager.pl into smaller, simpler pieces for ease of management, and so that I could easily recycle bits of code in other projects. Most of the code that does the heavy lifting is in the perl modules which have inline documentation which you can read with perldoc.

archive

Use this option to create a snapshot of your database, suitable for for distributing to replicated slaves.

        mysql_replicate_manager -a

The default location for backups is /var/backups/mysql. If you want them stored elsewhere configure then set backupdir = /path/to/backups in your .my.cnf (as shown in the FAQ).

create_tarball

This function creates a gzipped tar file containing your entire MySQL database directory. If you are not executing this script as root, and you don't have sudo, you'll have to get permissions set up properly before this will work at all.

We also create a file with the master binlog file and position info contained therein. The file has the replication master's log and pos info at the exact time the tarball was created.

copy_tarball

This function simply copies the tarball and .txt file to the remote slaves. The slaves are defined in ~/.my.cnf.

  mysql_replicate_manager -c

extract_slave_archive

This will untar the mysql database tarball on the slave. This relies on your having root (or the database uid) SSH keys configured so that root can drop into the slaves without prompting.

  mysql_replicate_manager -x

get_vars

Pull all the mysql variables from a MySQL master. We can parse these later to report a multitude of things about your server.


Dependencies

   DBI
   DBD::mysql


AUTHOR

Matt Simerson <matt@tnpi.biz>


BUGS

None known. Report any to author.


TODO

  Add MySQL slave promotion feature
  Make restoring a failed slave more brain dead easy
  Documentation, documentation, documentation
  Add commit/rollback support where appropriate
  check $sth->err and report any premature returns


SEE ALSO

  Mysql::Replication
  Mysql::Replication::Mysql
  Mysql::Replication::Perl
  Mysql::Replication::Utility

http://www.tnpi.biz/internet/sql/mrm/


COPYRIGHT

Copyright 2003-2004, The Network People, Inc. All Right Reserved.