tncPropel12LoadbalancerPlugin - 1.0.2

tncPropel12LoadbalancerPlugin - Loadbalancer for Propel 1.2

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

tncPropel12LoadbalancerPlugin plugin

Overview

This plugin extends the SfPeerBuilder to add the Load Balance feature to Propel 1.2.

Installation

cd my_project
php symfony plugin-install http://plugins.symfony-project.com/tncPropel12LoadbalancerPlugin
php symfony cc 

Requirements

Server Side:

  • ONLY works with Propel 1.2

  • The master slave setup should be done by the developer :)

Usage

Edit the databases.yml file of your project and change the following entry:

my_db_master:
  class:          sfPropelDatabase
  param:
     phptype:     mysql
     host:        192.168.0.1
     database:    db_name
     username:    username
     password:    password
     encoding:    utf8
     connectionReadOnly: my_db_slave_1, my_db_slave_2

my_db_slave_1:
 class:          sfPropelDatabase
 param:
   phptype:     mysql
   host:        192.168.0.2
   database:    db_name
   username:    username
   password:    password
   encoding:    utf8

my_db_slave_2:
  class:         sfPropelDatabase
  param:
    phptype:     mysql
    host:        192.168.0.3
    database:    db_name
    username:    username
    password:    password
    encoding:    utf8

Edit the propel.ini and change the following entry:

propel.builder.peer.class              = plugins.tncPropel12LoadbalancerPlugin.lib.tncPeerBuilder

Rebuild the model

Clear the cache

As shown here, on the custom connectionReadOnly attribute we enter our slaves connection names.

License

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.