Search code examples
mysqlmaster-slave

How can i take my mysql database into Master Slave configuration for data backup and separation of inserts and selects


I have a huge database almost 5M records and its growing at a high speed. I have a Query for report generation which joins 4 tables and the time it takes is not pretty. I want to replicate my database on a slave instance and separate inserts and select. So when i select data it goes to master and on inserts goes to slave and replicates the data whenever either one is updated. Whats your suggestion on this.


Solution

  • In MySQL terminology, user insertions and updates are directed to the Master, such changes are then forwarded to the Slave (so it is the other way around).

    If you want a bi-directional synchronisation, you will need to consider circular replication (here is a good tutorial).

    The next step is clustering, but this is a bit more complex to handle.