List:General Discussion« Previous MessageNext Message »
From:Andrés Tello Date:August 5 2010 5:17am
Subject:Re: Moving from one MySQL server to three MySQL servers?
View as plain text  
My experience with replication:

Most of the times, is good enough, fast enough... I have just reworked some
part of an application to split the reporting module from all other modules.


We are still using php 4.3 with pear::db module (what? legacy software is
hard to kill! we are trying!, Honest!)..

So, we need to pull 2 tricks, first of it was, that we setup replicatio to
two slaves... one for reporting, one for selects and had our master
instance.

we had an autoinclude file, which invoqued the db connection. The first
trick we pulled of was to detect if we where accesing the reports, by path
name using the a regexp over $_SERVER['SCRIPT_FILENAME'], if the filename
matched the modules regexp we instanciated the db connection to one of
slaves, the reports slave.

The other trick we made, was to modifie pear::db so we matched, again each
->query or ->simple_query against a regeexp containing the ^select pattern
and used the conection to the select database....

this allowed us to manage 3 databases, 1 for writing, 1 for selects and 1
for reporting with almos 0 changes to the actual code.

Hope this ideas work for you.

Maybe you aren't use php, but I bet you are using some kind of data base
abstraction layer...

Thread
Moving from one MySQL server to three MySQL servers?Nunzio Daveri4 Aug
  • Re: Moving from one MySQL server to three MySQL servers?Warren Young4 Aug
  • Re: Moving from one MySQL server to three MySQL servers?Wm Mussatto4 Aug
    • Re: Moving from one MySQL server to three MySQL servers?Prabhat Kumar4 Aug
      • Re: Moving from one MySQL server to three MySQL servers?Andrés Tello5 Aug
  • Re: Moving from one MySQL server to three MySQL servers?Joerg Bruehe5 Aug
  • RE: Moving from one MySQL server to three MySQL servers?Steven Staples5 Aug
    • Re: Moving from one MySQL server to three MySQL servers?Nunzio Daveri5 Aug
      • Re: Moving from one MySQL server to three MySQL servers?Andrés Tello6 Aug
      • Re: Moving from one MySQL server to three MySQL servers?Warren Young9 Aug
      • Re: Moving from one MySQL server to three MySQL servers?Todd Lyons18 Aug