Difference: 1. Asynchronous replication means that the Master writes the event to the binlog. It does not know whether the slave has received or processed it. There is no guarantee that all transactions are received by all slaves; 2. Synchronous replication means that the Master submits the transaction until Only when all slaves have submitted the transaction will the client transaction execution completion information be returned.
Related learning recommendations: mysql tutorial (video)
mysql synchronization The difference between replication and asynchronous replication:
Asynchronous replication
MySQL replication defaults to asynchronous replication. The Master writes events to the binlog, commits the transaction, and does not itself Know whether the slave receives or processes it;
Disadvantages: There is no guarantee that all transactions are received by all slaves.
Synchronous replication
Master submits the transaction and will not return client transaction execution completion information until the transaction has been submitted on all slaves;
Disadvantages : There may be delays in completing a transaction.
Semi-synchronous replication
When the semi-synchronous replication function is enabled on the Master, at least one slave has its function enabled. When the Master submits a transaction to the slave, and the transaction has been written into the relay-log and flushed to the disk, the slave will notify the Master that it has been received; if the Master's submission of the transaction is blocked and a waiting timeout occurs, the Master will not be informed within a certain period of time that it has been received. Received, the Master automatically converts to an asynchronous replication mechanism at this time;
Note: The semi-synchronous replication function must be enabled on the Master and the slave to take effect. If only one side is enabled, it is still asynchronous replication.
This article comes from the php Chinese website mysql graphic tutorial channel, welcome to learn!
The above is the detailed content of What is the difference between mysql synchronous replication and asynchronous replication?. For more information, please follow other related articles on the PHP Chinese website!