![]() |
|
tncPropel12LoadbalancerPlugin - 1.0.2tncPropel12LoadbalancerPlugin - Loadbalancer for Propel 1.2 |
|
This plugin extends the SfPeerBuilder to add the Load Balance feature to Propel 1.2.
cd my_project
php symfony plugin-install http://plugins.symfony-project.com/tncPropel12LoadbalancerPlugin
php symfony cc
Server Side:
ONLY works with Propel 1.2
The master slave setup should be done by the developer :)
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.
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.