Conclusions and Opinions
First, make sure you get a complete data snapshot. Forgetting to copy a table or database will cause the standby line program to stop. The time when the snapshot is generated is critical. You should ensure that the binary logging functionality is disabled before copying the data files. If the binary log function is enabled before taking the snapshot, the thread on the standby machine may stop because when the thread tries to import important records, it may stop due to duplicate primary keys. The best thing to do is to follow the solution discussed in part 2: close-copy-allow the binary log function to restart.
You may want to configure the replication process in the original way, and pay attention to the standby machine at the appropriate time to ensure that the standby machine is in sync with the master machine.
I have not tested the load balancing performance of a system that uses the replication feature, but I would be flexible in using such a system to balance inserts and updates. For example, if two records on two servers give the same auto_increment value, which record will the standby thread stop on? A problem like this would result in load balancing being handled as read-only, with one server handling all inserts and updates, while a set of standbys (yes, you can have multiple standbys separate from the master) handle all selections .
I am very happy that MySQL already has some functions of the replication system, and the configuration is very simple. Using this, you can begin to provide additional security against out-of-control events.
Translator's words:
Since I originally used version 3.22 of MySQL, I had to download the latest program of version 3.23.24 in order to test it. And since there is only one machine, I just increased the binary log settings. However, as this article states, files are indeed generated. If you are interested in this, please test it yourself. In addition, in the latest MySQL user manual, I found that this replication function is only available after version 3.23.15. Please check your own MySQL version. At the same time, the settings for the binary log in the article are set in my.cnf. In the 3.23.24 version I am using, the manual says that there are three files for parameter setting, which are the my.ini file in the windows directory, c:my.cnf and c:mysqldatamy.cnf. When I set up "log-bin" (no need to set the log parameters first), I used the WinMySQLadmin software that comes with mysql to set it up, and set it in my.ini. It is different from the one in the article. Please test it yourself.