edbconnection Extends CDbConnection for MySQL Multi Master Setups


  1. Installation
  2. Credits

Extends Yii's CDbConnection for MySQL Multi-Master Setups.

The EDbConnection component handles some kind of connection pooling in environments with MySQL Multi-Master Setups. This component/extension will poll MySQL Master server one after another until it finds a functional server to create a connection. Every unavailable server will be marked as dead and that information will be stored in memcache.<br/> For that reason you have to configure a cache component!


Just copy the EDbConnection.php file to your protected/component folder and add a component to your protected/config/main.php like that (or modify an existing one):

       'connectionString' => 'mysql:host=localhost;dbname=myDatabase;port=3306', // this is the original connectionString, can be removed
       'connectionArray' =>  array( // THIS IS IMPORTANT TO ADD!
       'emulatePrepare' => true,
       'username' => 'myUsername',
       'password' => 'myPassword',
       'charset' => 'utf8',
       'enableParamLogging' => true,


This piece of software was inspired by this extension/component: http://www.yiiframework.com/extension/dbreadwritesplitting/

EDbConnection on GitHub

2 0
Yii Version: Unknown
License: GPL-2.0
Category: Database
Developed by: rall0r
Created on: Oct 6, 2013
Last updated: 10 years ago

Related Extensions