Why is MySQL replication needed?
MySQL master slave replication is carried out by many for more reasons than one. They could be:
- To Speed up your application: One of the biggest points of interest to have master-slave set up in MySQL is to have the ability to utilize master for the inserts, update and delete queries and slave for select queries. This will generally likely to accelerate your website without needing to swooping into optimizing all the queries or purchasing more hardware.
- To Replicate your Database: Replication is the main innovation that can fulfill the necessities of the most requesting systems, as just replication can give moment access to information and zero information loss.
- To enable Disaster recovery strategy: A database can get unusable because of a wide assortment of hardware or software washouts. Master slave cloning will automatically create a copy of your primary database and thus you always have latest copy of your database.
- To keep the backup up to date: Data on the slave server is more likely to be up to date than on a periodical backup which is only performed periodically (eg: daily). If there is a complete failure of the Master Server, the Slave Server can be made available to take over the functionality, or it can be used to restore data with minimal loss.
What is MySQL master slave replication?
MySQL master slave replication is a configuration made with two MySQL database servers which allows them to easily maintain multiple copies of MySQL data. I have described in the below step wise tutorial on how to set up MySQL master-master replication. This configuration let’s slave database to automatically copy the data from master MySQL database.
What are the advantages of MySQL master slave replication?
This kind of configuration is done for many reasons as it has many advantages including,
- Automatic database backup ,
- A way to analyze the database without using the main database,
- Automatically maintaining clone of the server.
Architecture of the Master Slave configuration:
On Master,
- Get the Replication Master Binary Log Coordinates
- Create a data snapshot using mysqldump
- Transfer the data on Slave
On Slave,
- Restore the data snapshot
- Set the Slave to start replication
Watch out this space soon to find the step wise process to do the set up for master slave replication.