dpdbu24262 2013-09-09 21:19
浏览 32

Zend DB和拆分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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?
    • ¥15 matlab(相关搜索:紧聚焦)
    • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
    • ¥15 路易威登官网 里边的参数逆向
    • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
    • ¥50 需求一个up主付费课程