DBIx-MySQL-Replication-Slave

 view release on metacpan or  search on metacpan

lib/DBIx/MySQL/Replication/Slave.pm  view on Meta::CPAN


By default this is set to a very generous number (86400 seconds). Set this
value if you'd like to take a shorter amount of time into account when
checking on your health. This is strongly recommended:

    # Anything longer than 30 seconds is not acceptable
    my $slave = DBIx::MySQL::Replication::Slave->new(
        dbh => $dbh,
        seconds_behind_master => 30
    );

If you think it's cleaner, you can also set this value *after* object creation.

    $slave->max_seconds_behind_master(30);

=back

=head1 SUBROUTINES/METHODS

=head2 status

Returns a HASHREF of the MySQL slave status variables.  These vars will, by
default, be converted to lower case, unless you have turned this off when you
construct the object.  See the lc option to new() for more info.

=head2 refresh_status

Issues a fresh "SLOW SLAVE STATUS" query and returns the new results of
$slave->status to you.

=head2 start

Issues a "START SLAVE" query and returns DBI's raw return value directly to
you.

=head2 stop

Issues a "STOP SLAVE" query and returns DBI's raw return value directly to
you.

=head2 slave_ok

This method returns true if slave_io_running and slave_sql_running are both
equal to 'Yes' AND if seconds_behind_master is <= max_seconds_behind master.

=head2 is_running

Returns true if both slave_io_running and slave_sql_running are set to 'Yes'

=head2 is_stopped

Returns true if both slave_io_running and slave_sql_running are set to 'No'.
If only one of these values returns 'Yes', it's probably fair to say that the
slave is in some transitional state. Neither stopped nor running may be an
accurate description in this case.

=head1 AUTHOR

Olaf Alders, C<< <olaf at wundercounter.com> >>

=head1 BUGS AND LIMITATIONS

Please report any bugs or feature requests to
C<bug-dbix-mysql-replication-slave at rt.cpan.org>, or through the web
interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-MySQL-Replication-Slave>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

=head1 TESTING

Have a look at the source of t/connect.t if you'd like to do more extensive
testing of your install. This will require that you already have a fully
functional slave set up in order for the tests to pass. These tests are
skipped by default, but you are encouraged to run them as part of your install
process.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DBIx::MySQL::Replication::Slave


You can also look for information at:

=over 4

=item * GitHub Source Repository

L<http://github.com/oalders/dbix-mysql-replication-slave>

=item * RT: CPAN's request tracker

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-MySQL-Replication-Slave>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/DBIx-MySQL-Replication-Slave>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/DBIx-MySQL-Replication-Slave>

=item * Search CPAN

L<http://search.cpan.org/dist/DBIx-MySQL-Replication-Slave/>

=back

=head1 ACKNOWLEDGEMENTS

Thanks to Raybec Communications L<http://www.raybec.com> for funding my
work on this module and for releasing it to the world.


=head1 LICENSE AND COPYRIGHT

Copyright 2010 Olaf Alders.

This program is free software; you can redistribute it and/or modify it



( run in 1.320 second using v1.01-cache-2.11-cpan-39bf76dae61 )