MySQL master-slave replication and read/write separation

Source: Internet
Author: User

The so-called read and write separation is the preparation of two types of MySQL database, a update operation (master), a query operation (slave). Call Master when the application needs to update data and invoke slave when querying data. The benefit of doing this is to share the business processing of a single database with multiple databases, or load balancing, so there is a problem when Master's data is synchronized to slave in what way? This time to use the master-slave replication, master-slave replication provides a number of ways to synchronize the master data into the slave, how to practice please refer to other articles on the network.

Below is a picture of the system structure:


On the top of the use of master-slave replication to achieve read and write separation to improve the load capacity of the system, in fact, you should add a master to achieve high availability of the database system, so that any one of the database server downtime does not affect the system business use.

about how the application system realizes read-write separation, high availability according to the specific project situation, for example: Configure multiple data sources in the spring project, use the AOP pointcut to call the master data source according to Save*, update*, delete* and so on, according to Find*, get*, Query* to invoke the slave data source.

MySQL master-slave replication and read/write separation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.