summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFelix Balfoort <fhjbalfoort@gmail.com>2011-11-29 15:53:01 +0100
committerFelix Balfoort <fhjbalfoort@gmail.com>2011-11-29 15:53:01 +0100
commitea6e466309887cef69f5685f97d17e6e6b335c2f (patch)
tree66c925650eee47f35a4fa7d5a5b42c648cde835d /application
parent0bb866e6e1c55a536a3029eaaf1913e46512a51a (diff)
The DB_driver can now use failover databases if specified
The DB_driver can now use failover databases if specified. If the main connection shouldn't connect for some reason the DB_driver will now try to connect to specified connections in the failover config. Example config: $db['default']['hostname'] = 'localhost'; $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE; $db['default']['stricton'] = FALSE; $db['default']['failover'] = array(); $db['default']['failover'][0]['hostname'] = 'localhost1'; $db['default']['failover'][0]['username'] = ''; $db['default']['failover'][0]['password'] = ''; $db['default']['failover'][0]['database'] = ''; $db['default']['failover'][0]['dbdriver'] = 'mysql'; $db['default']['failover'][0]['dbprefix'] = ''; $db['default']['failover'][0]['pconnect'] = TRUE; $db['default']['failover'][0]['db_debug'] = TRUE; $db['default']['failover'][0]['cache_on'] = FALSE; $db['default']['failover'][0]['cachedir'] = ''; $db['default']['failover'][0]['char_set'] = 'utf8'; $db['default']['failover'][0]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][0]['swap_pre'] = ''; $db['default']['failover'][0]['autoinit'] = TRUE; $db['default']['failover'][0]['stricton'] = FALSE; $db['default']['failover'][0]['failover'] = array(); $db['default']['failover'][1]['hostname'] = 'localhost2'; $db['default']['failover'][1]['username'] = ''; $db['default']['failover'][1]['password'] = ''; $db['default']['failover'][1]['database'] = ''; $db['default']['failover'][1]['dbdriver'] = 'mysql'; $db['default']['failover'][1]['dbprefix'] = ''; $db['default']['failover'][1]['pconnect'] = TRUE; $db['default']['failover'][1]['db_debug'] = TRUE; $db['default']['failover'][1]['cache_on'] = FALSE; $db['default']['failover'][1]['cachedir'] = ''; $db['default']['failover'][1]['char_set'] = 'utf8'; $db['default']['failover'][1]['dbcollat'] = 'utf8_general_ci'; $db['default']['failover'][1]['swap_pre'] = ''; $db['default']['failover'][1]['autoinit'] = TRUE; $db['default']['failover'][1]['stricton'] = FALSE; $db['default']['failover'][1]['failover'] = array(); Signed-off-by: Felix Balfoort <fhjbalfoort@gmail.com>
Diffstat (limited to 'application')
-rw-r--r--application/config/database.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/application/config/database.php b/application/config/database.php
index 28b792f75..12ef7fed0 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -62,6 +62,7 @@
| ['autoinit'] Whether or not to automatically initialize the database.
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
+| ['failover'] array - A array with 0 or more data for connections if the main should fail.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
@@ -88,6 +89,24 @@ $db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
+$db['default']['failover'] = array();
+
+$db['default']['hostname'] = 'localhost';
+$db['default']['username'] = '';
+$db['default']['password'] = '';
+$db['default']['database'] = '';
+$db['default']['dbdriver'] = 'mysql';
+$db['default']['dbprefix'] = '';
+$db['default']['pconnect'] = TRUE;
+$db['default']['db_debug'] = TRUE;
+$db['default']['cache_on'] = FALSE;
+$db['default']['cachedir'] = '';
+$db['default']['char_set'] = 'utf8';
+$db['default']['dbcollat'] = 'utf8_general_ci';
+$db['default']['swap_pre'] = '';
+$db['default']['autoinit'] = TRUE;
+$db['default']['stricton'] = FALSE;
+$db['default']['failover'] = array();
/* End of file database.php */