Using a different MySql DB for write operations in CakePHP
I need to scale my mysql RDS instance. I can launch read replicas in amazon RDS, but problem is that the write operations won't work on read replicas. I need to redirect all the write operations (INSERT, UPDATE, DELETE) on master server somehow, and all the read operations on a read replica.
RDS will take care of synchronizing the read replica with latest changes.
is there any easy way to modify cake to execute all the write commands on a different DB? without changing the controllers or models?
my existing server is not able to handle the connections and cpu spikes. already tried to upgrade it, but it did not work.
I appreciate your help. Thank You.
在AppModel :: beforeSave()中设置不同的数据源,并在afterSave()中将其设置回另一个数据源。
链接地址: http://www.djcxy.com/p/83262.html