• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Failover in Codeigniter 2.0.2

#1
[eluser]LynxCoder[/eluser]
Hello All,
Can anyone point me in the right direction? I've got Codeigniter 2.0.2 running on a project that i'm working on, connecting to Xeround Cloud database system, and all is working well. Xeround provide two connection hostnames to provide fall over and i'm looking at how to implement it.

Basically, I want Codeigniter to autoload the database on the primary access (as it does now) and all works fine, but if for some reasons the primary access doesn't work, I need to catch that, and tell it to retry on the secondary. My idea was two have two database groups and if a connection problem occurred, simply swap the active group and retry ... but i'm not sure where and how to check the connection?

Can any one offer any suggestions? I don't really want to have to do a manual database load on all controllers/models etc..

Cheers

#2
[eluser]toopay[/eluser]
Create MY_Controller.php, put it on "core" folder, and load the database or swap or do anything there. Then simply extend onther controller from it.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.