MySQL master-slave replication principle --- talking about mysql master-slave
Learning and learning make me happy !!
The built-in replication function of MySQL is the basis for building large and high-performance applications. Distribute MySQL Data to multiple systems. This Distributed Mechanism copies data from one MySQL host to another Server Load balancer, and execute the code again.
During the replication process, one server acts as the master server, and one or more other servers act as slave servers. The master server writes updates to binary log files and maintains an index of the files to track log loops. These logs can record updates sent to the slave server. When an slave server is connected to the master server, it notifies the master server of the last successful update location read from the server in the log. The slave server receives any updates from that time, blocks them, and waits for the master server to notify you of updates.
Note that all updates to the copied table must be performed on the master server. Otherwise, you must be careful to avoid conflicts between updates to tables on the master server and those on the slave server.
MySQL supports the following replication types:
(1) Statement-based replication: the SQL statement executed on the server and the same statement executed on the slave server. MySQL uses statement-based replication by default, which is more efficient.
(2) Row-based replication: Copies the changed content instead of running the command on the slave server. Supported since MySQL5.0.
(3) hybrid replication: Statement-based replication is used by default. If statement-based replication fails, row-based replication is used.
MySQL replication technology has the following features:
(1) Data Distribution
(2) Load Balancing
(3) backup
(4) backup availability and fault tolerance
Simple original description ------ I wrote the specific setup steps in the previous article !!