Home>Article>Database> What is the difference between mysql synchronous replication and asynchronous replication?

What is the difference between mysql synchronous replication and asynchronous replication?

青灯夜游
青灯夜游 Original
2020-09-03 13:27:38 4141browse

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.

What is the difference between mysql synchronous replication and asynchronous replication?

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 websitemysql graphic tutorialchannel, 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn