Search code examples
mysqlcodeigniterdatabase-replicationmysql-proxy

MySQL proxy redirect Read/Write


We have a system where we have a Master / Multiple Slaves .

Currently everything happens on the Master and the slaves are just here for backup .

We use Codeigniter as a development platform .

Now we decided to user the slaves for the Reads and the Master for the Write queries .

I have been told that this is not doable without modifying the source code because proxy can't know the type of the query .

Any idea how to proceed with this without causing too much damages for a perfectly working system ...


Solution

  • We will use this : http://dev.mysql.com/downloads/mysql-proxy/

    It does exactly what we want :

    enter image description here

    More info here :

    http://jan.kneschke.de/2007/8/1/mysql-proxy-learns-r-w-splitting/

    http://www.infoq.com/news/2007/10/mysqlproxyrwsplitting

    http://archive.oreilly.com/pub/a/databases/2007/07/12/getting-started-with-mysql-proxy.html