Catalyst::TraitFor::Model::DBIC::Schema::Replicated3pm
Replicated storage support for catalyst::model::dbic::schema
Usage
__PACKAGE__->config({traits => ['Replicated']connect_info =>['dbi:mysql:master', 'user', 'pass'],replicants => [['dbi:mysql:slave1', 'user', 'pass'],['dbi:mysql:slave2', 'user', 'pass'],['dbi:mysql:slave3', 'user', 'pass'],],balancer_args => {master_read_weight => 0.3}});
Overview
Sets your storage_type to DBIx::Class::Storage::DBI::Replicated and connects replicants provided in config. See that module for supported resultset attributes.
The default "balancer_type" in DBIx::Class::Storage::DBI::Replicated is "::Random".
Sets the "master_read_weight" in DBIx::Class::Storage::DBI::Replicated::Balancer::Random to 1 by default, meaning that you have the same chance of reading from master as you do from replicants. Set to 0 to turn off reads from master.
Config parameters
replicants
Array of connect_info settings for every replicant.
The following can be set via "connect_info" in Catalyst::Model::DBIC::Schema, or as their own parameters. If set via separate parameters, they will override the settings in "connect_info".
pool_type
See "pool_type" in DBIx::Class::Storage::DBI::Replicated.
pool_args
See "pool_args" in DBIx::Class::Storage::DBI::Replicated.
balancer_type
See "balancer_type" in DBIx::Class::Storage::DBI::Replicated.
balancer_args
See "balancer_args" in DBIx::Class::Storage::DBI::Replicated.
Releases
8 releases since Debian 6.0 (Squeeze); the text changed 5 times.