Class::DBI::Replicated - Replication from single master to multiple slaves
Version 0.040
package My::DBI; use base qw(Class::DBI::Replicated::mysql); # use base qw(Class::DBI::Replicated::Pg::Slony1); My::DBI->replication(\%arg);
Class::DBI::Replicated does some stuff, blah blah.
replication
$class->replication(\%arg);
Analogous to connection. Takes a single hashref.
connection
a single arrayref (as passed to connection)
an arrayref of arrayrefs, one per slave. NOTE: currently, using more than one slave does nothing.
If present, these specify the user and password to use for replication-specific queries (such as MySQL's SHOW MASTER STATUS).
SHOW MASTER STATUS
replication_db
Returns the name of the current database in use (minus the leading db_).
db_
db_Main
Return a master or slave DBH, as dictated by the current replication state.
db_Slave
Always returns a DBH for the most recently-used slave.
db_Master
Generated by Class::DBI.
db_Slave_Repl
Most recently-used slave's connection for replication.
Falls back to db_Slave if no user/password given
db_Master_Repl
Master's connection for replication.
Falls back to db_Master if no user/password given
switch_to_master
switch_to_slave
wait_for_slave
That is, methods dealing specifically with replication positions.
repl_mark
Get current master position and save it
repl_pos
Class data accessor/mutator for current marked master position
repl_get_master
virtual (scalar)
repl_get_slave
repl_check
if ($class->repl_check) { ...
repl_wait
unless ($class->repl_wait(\%arg)) { # not up to date }
Possible arguments:
defaults to 30
slave name, defaults to the first one
die instead of returning 0
return 0 for failure
repl_compare
my $later = $class->repl_compare($my_pos, $master_pos);
virtual (boolean)
return 1 if $my_pos is at least as new as $master_pos return 0 otherwise
before_create
before_update
before_delete
switch to using master
after_create
after_update
after_delete
mark master position
select
mk_force_masters
mk_markers
replication_args
Extra Params::Validate specifications for replication.
replication_setup
Called automatically inside replication.
Gets a hashref of the arguments to replication.
Hans Dieter Pearcey, <hdp@cpan.org>
<hdp@cpan.org>
Please report any bugs or feature requests to bug-class-dbi-replicated@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-DBI-Replicated. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-class-dbi-replicated@rt.cpan.org
Copyright 2005 Hans Dieter Pearcey, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Class::DBI::Replicated, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::DBI::Replicated
CPAN shell
perl -MCPAN -e shell install Class::DBI::Replicated
For more information on module installation, please visit the detailed CPAN module installation guide.