edbconnection Extends CDbConnection for MySQL Multi Master Setups

yii-EDbConnection

  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!

Installation

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):

   'db'=>array(
       'connectionString' => 'mysql:host=localhost;dbname=myDatabase;port=3306', // this is the original connectionString, can be removed
       'connectionArray' =>  array( // THIS IS IMPORTANT TO ADD!
           'mysql:host=mysql-server1.example.com;dbname=myDatabase;port=3306',
           'mysql:host=mysql-server2.example.com;dbname=myDatabase;port=3306'
       ),
       'emulatePrepare' => true,
       'username' => 'myUsername',
       'password' => 'myPassword',
       'charset' => 'utf8',
       'schemaCachingDuration'=>36000,
       'enableParamLogging' => true,
       'class'=>'EDbConnection'
   ),

Credits

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

EDbConnection on GitHub

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

Related Extensions