Copyright (c) 2007 Matthias Nothhaft
MIT License
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.
Installation for sf 1.2
php symfony plugin:install sfPropelLoadbalancerPlugin --release=0.1.0
Installation for sf 1.1
php symfony plugin:install sfPropelLoadbalancerPlugin --release=0.1.0
Installation for sf 1.0
php symfony plugin-install http://plugins.symfony-project.org/sfPropelLoadbalancerPlugin
PEAR
Download the PEAR package
Repository
Go to the repository: http://svn.symfony-project.com/plugins/sfPropelLoadbalancerPlugin
sfPropelLoadbalancerPlugin
Abstract
This plugin implements a simple loadbalancer for Propel with Creole. It is based on the
sfDebugConnection class. The loadbalancer is currently meant for replication setups of
single master and multiple slaves. Balancing simply chooses one of the available slaves
randomly.
This plugin requires symfony 1.0.x.
Be aware that it doesn't use any database specific queries for example to ensure that slaves are synced.
The might lead to problems on high traffic sites.
Getting started
- Install the plugin. Clear the cache.
You have to enable it in app.yml otherwise it will not do anything.
all:
sfPropelLoadbalancerPlugin:
enabled: true
In your databases.yml you have to replace sfPropelDatabase by sfPropelLoadbalancerDatabase
There are two additional parameters that must be configured correctly. Here is a complete example:
all:
# master server connection (only one is supported)
symfony:
class: sfPropelLoadbalancerDatabase
param:
phptype: mysql
hostspec: ##host##
database: ##database##
username: ##user##
password: ##password##
compat_assoc_lower: true
compat_rtrim_string: true
is_master: true # you have to set one connection to be the master
master_mode: rw # w is mandatory, r also uses master connection for selects
# slave server connections (multiple slaves are supported)
slave1:
class: sfPropelLoadbalancerDatabase
param:
phptype: mysql
hostspec: ##host##
database: ##database##
username: ##user##
password: ##password##
compat_assoc_lower: true
compat_rtrim_string: true
enable_loadbalancer: false # you can exclude a connection from loadbalancing
Caution
This plugin is alpha! Please test it and make backups first before running it in production.
There might be open issues that could lead to inconsistent data.