Copyright (c) 2008 TheNetCircle.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
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:
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.