We have a master/slave MySQL setup and we were wanting to split some of the reads to the slave.
Basically, we want it to be set up as such:
- All writes will happen using the master
- Any reads that need to be accessed shortly after they are written will use the master
- All other reads will favor the slave
- If the slave is down, all reads should use the master
Right now we have a custom DB_Adapter that extends Zend_Db_Adapter_Pdo_Mysql. What I was thinking about doing was just setting up another variable in the config.ini file that authenticates to the slave using a read_only credential set, then instantiating a second DB_Adapter in the bootstrap using Zend_DB::factory($config->slaveDatabase);
I also came across Zend_Application_Resource_Multidb. Is there any advantage to using the Multidb resource for this over just creating a second set of variables?
And is there any way to set the failover so that if the slave is down any reads using it will use the master instead?