In MySQL replication, relative to the main master replication, master-slave architecture of better stability, and the main owners will always have some problems, it is not recommended. Master-slave replication based on read-write separation is recommended in large architectures
This article does not involve the content of read-write separation, but simply realizes the master-slave copy of MySQL. The whole process of understanding the principle of replication is very simple, so the first simple introduction of the principle.
The fundamentals of MySQL's master-slave replication:
On the primary server, the binary log is sent to the server, the received relay log is read from the server, the SQL statements in the log are executed, and data synchronization is achieved.
The entire implementation process is shown in the following illustration, and it is easy to see the whole process through the picture
For the master and slave between the use of asynchronous transmission or synchronous transmission, specific look at the network situation and the overall structure of the
Note that for compatibility issues, Master's MySQL version is lower or the same than the slave version between the master and the server.
If you are deploying a standby server on a primary server that already has data, to back up the primary server's data, make a copy of the binary log location record at the time of the backup, and then revert to the server and specify the replication location from the server's binary log from the primary server, starting at the Point-in-time.
Implementation process
First of all, install MySQL on 2 servers. Installation steps are no longer listed, I am using the green version of the installation, the MySQL configuration of both sides the best
Modify My.cnf,master Modify Server-id for 1,slaver modify Server-id is greater than 1 of the number
Master
Slave
Turn off binary logs from the server to avoid high IO on the server and open Relay-log