|
NAMEClass::DBI::Replication - Class::DBI for replicated database SYNOPSIS package Film;
use base qw(Class::DBI::Replication);
Film->set_master('dbi:mysql:host=master', $user, $pw);
Film->set_slaves(
[ 'dbi:mysql:host=slave1', $user, $pw ],
[ 'dbi:mysql:host=slave2', $user, $pw ],
);
DESCRIPTIONClasss::DBI::Replication extends Class::DBI's persistence for replicated databases. The idea is very simple. SELECT from slaves, INSERT/UPDATE/DELETE to master. From http://www.mysql.com/doc/R/e/Replication_FAQ.html, Q: What should I do to prepare my client code to use performance-enhancing replication? A: If the part of your code that is responsible for database access has been properly abstracted/modularized, converting it to run with the replicated setup should be very smooth and easy - just change the implementation of your database access to read from some slave or the master, and to always write to the master. With Class::DBI::Replication, it can be done easily! METHODS
TODO
AUTHORTatsuhiko Miyagawa <miyagawa@bulknews.net> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSOClass::DBI, Class::DBI::mysql
|