Mysql:How do I force the master to block updates until the slave catches up?
其他
2020-03-25 14:51:05
阅读次数: 0
A.14.4.
|
How do I force the master to block updates until the slave catches up? |
|
Use the following procedure:
-
On the master, execute these statements: mysql> FLUSH TABLES WITH READ LOCK;
mysql> SHOW MASTER STATUS;
Record the replication coordinates (the current binary log file name and position) from the output of the SHOW statement.
-
On the slave, issue the following statement, where the arguments to the MASTER_POS_WAIT() function are the replication coordinate values obtained in the previous step: mysql> SELECT MASTER_POS_WAIT('log_name ', log_pos );
The SELECT statement blocks until the slave reaches the specified log file and position. At that point, the slave is in synchrony with the master and the statement returns.
-
On the master, issue the following statement to enable the master to begin processing updates again: mysql> UNLOCK TABLES;
|
转载自www.cnblogs.com/jinzhenshui/p/12566153.html