Monday, March 30, 2009

Re: Useing different database for the different actions

I think this is what you are looking for

http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-master-and-slaves-2


On Mar 30, 6:28 pm, Alfredo Quiroga-Villamil <laww...@gmail.com>
wrote:
> Pippo:
>
> I've never done this or even thought about how to do it; so there
> might be a better way to accomplish what you want. Perhaps what I am
> about to tell you might not be a valid solution; but one thing that
> comes to mind is the following:
>
> Assuming that what you want is to read from one DB and perform CUD
> operations on the other one (Master), you could try to:
>
> Overwrite the methods related to "select" in AppModel and specify the
> DB to use for those cases. Do the same for methods that will be of CUD
> type in AppModel and point in this case to the other database you
> would like to use (master in this case)
>
> Everyone, please keep me honest here.
>
> Regards,
>
> Alfredo
>
> On Mon, Mar 30, 2009 at 11:42 AM, Pippo <phil...@wuermli.com> wrote:
>
> > Hi
>
> > We would like to use scalr.net and amazon webservices in order to be
> > able to scale if we have more and more users.
>
> > We would like to use one master Database and some slave Databases. The
> > synchronization in between of the different databases will go only in
> > one way, from the master to the slaves. This would mean that we need
> > to be able to differentiate in between of the actions done to the
> > database. All the Select statements (cakephp function find) would need
> > to go to the slaves, the Insert and Update statements should go to the
> > master database. The different Databases are on different Servers
> > (IP).
>
> > I couldn't find any information how this could be done with cakephp. I
> > have seen that I can use different databases by defining  useDbConfig
> > (http://book.cakephp.org/view/435/useDbConfig) but this would mean
> > that it would do all the type of SQL statement to one Database, no
> > matter whether it is a SELECT (read data) or an UPDATE or INSERT
> > (edit, create data).
>
> > Did someone have the same issue and does someone have a solution for
> > this?
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: