Zend DB y división de lecturas/escrituras de MySQL

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:

  1. All writes will happen using the master
  2. Any reads that need to be accessed shortly after they are written will use the master
  3. All other reads will favor the slave
  4. 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?

preguntado el 09 de septiembre de 13 a las 22:09

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.