Sean P. Quinlan > DBA-Backup-mysql-0.2_1 > DBA::Backup::mysql



Annotate this POD

Module Version: 0.2_1   Source  


NOTICE! This is currently a broken partial port from the origal working MySQL specific module. I hope to have the port finished and a functional version uploaded soon. Email me or the list for more information.

The mailing list for the DBA modules is See to subscribe.

mysql_flush_logs ^

Uses mysqladmin refresh to flush all logs and tables.

mysql_rotate_logs ^

Rotates the binary update, error and any extra mysql logs specified in the conf file. Rotation of binary and error logs is not optional on runs when the databases get backed up. Error and binary logs are kept as incrementals. Other logs are just appended, and are cleared and restarted once over a certain size (as defined in conf).

_rotate_error_log() ^

        The mysql error logs don't operate the same way as the other logs.
        As of mysql 4.0.10, every flush-logs command will cause the error log
        to rotate to a file with an "-old" suffix attached.  This is
        regardless of the file's size.  Mysql shutdown/startup will *not*
        rotate the error log to the -old file.  Any previous -old file
        is deleted.

        This function attempts to restore some sanity to how mysql treats
        the error log.  Call this function after the flush-logs command.
        We will take new -old file and append it to the end of our own file,
        (different name) and delete the -old file.  We'll then call the usual
        _rotate_generic_log function on it.

_cycle_bin_logs() ^

        Issues command to mysqld to finish writing to the current binary
        update log and start writing to a new one.  We then push all of
        the bin-logs (except for the newest one) into [dump_dir]/00/.

        The flush logs command causes mysqld to close the old (already renamed)
        general query and slow query logs and reopen the logs of the usual
        file name.  It also causes mysqld to flush the binary update log and
        begin writing to a new binlog file.  It does not affect the error 
        log, only a restart of mysqld will start a new error log.

        The flush hosts command will clean up the hosts cache.

_backup_databases() ^

        Backup all databases on the server DBMS which are mentioned 
        explicitly or as a pattern in the [included-databases] section 
        in the config file.

        This function will dump all specified databases to .sql.gz files
        in the directory [dump_dir]/new/.  If there were no errors during
        backup, _rotate_dump_dirs will then rename it [dump_dir]/00/.

        If this function encounters errors during backup, the partial dumps 
        to [dump_dir]/new/ will remain until the next time this function is
        executed.  At that time, the contents of [dump_dir]/new/ will be
        destroyed and new dumps will be placed there.

        At no time are binary update logs ever placed in [dump_dir]/new/.

        Return with the number of errors encountered during backup.


DBA::Backup::mysql - MySQL server extension for DBA::Backup


This module is not used directly. It is a server extension for the DBA::Backup module. See the instalation directions for more information.




Original version; created by h2xs 1.23 with options


Partially ported from original functional MySQL specific module. Currently broken, but I wanted to get the structure set up and uploaded to CPAN.


Some more work on getting port working and some comments. Early release for mailing list.


Improved configuration handling allowing multiple mysql servers. Sample configuration file updated to reflect change. Methods now expect server specific configuration to be passed explicitly and no longer look up in $self->{mysql_server} directly.


The mailing list for the DBA modules is See to subscribe.


Sean Quinlan, <>

Original version by Stefan Dragnev, <> with contributions from Norbert Kremer, <<gt> and Danny Park, <<gt>


Copyright (C) 2004 by Sean P. Quinlan & Stefan Dragnev

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: