MySQL master-slave replication drawing layman (4) Principle

First, how to read and write from the primary separation MySQL

    1, a program implemented by separate read and write (performance, optimum efficiency, it is recommended)

    php and java programs can read and write separate databases, ie, when the select, go to the library to read the file connection, when updata, insert, delete database connection to connect to write files easily by providing a plurality of connection file .

    2, implemented by separate read and write software

    MySQL-proxy, Amoeba and other agent software can also read and write separation function, but the most common or easy to use program to read and write separation.

    3, development dbproxy

Second, the master-slave replication diagram:

 

 

 Three, MySQL master-slave replication process principle

    1, time synchronization, from the library there are two threads to complete IO, SQL thread, the main thread from a complete IO thread.

    2, is connected to a position disposed above the main library from the library IP, User name, account, password, file, and pos points.

    3, before turning on the switch, to ensure that the main from the library is the same.

    4, to be built on the main library devoted to an account from the library synchronization.

    5, the main library to open binlog switch, or can not be synchronized.

    6, open process of switching from the library, in fact, is to make IO, process SQL thread work

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/cnxy168/p/11655828.html