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:54:00 +0100
commit5d581b6d664c6ef662bcb9572ca147ac17af52cb (patch)
tree70118d4a8979d2faf220483caf4aef7fb63f7194 /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.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/application/config/database.php b/application/config/database.php
index 28b792f75..58eec4b30 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,7 +89,7 @@ $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 */
/* Location: ./application/config/database.php */ \ No newline at end of file