MySQL has more slave database logs than the master database

Source: Internet
Author: User

MySQL has more slave database logs than the master database

When chatting in the Group, a group member said that the master database of the MySQL production database is down, but the data of the master and slave databases is consistent, but the logs of the slave database are more than that of the master database, which is hard to understand!

After consulting, we found that the master database of the production database is not set sync_binlog = 1, but sync_binlog = 0.

Therefore, when the master database writes data, the transaction has been committed, but the data is not written to the disk in the binlog cache, and the data has been synchronized to the slave database. At this moment, the master database is down, the data in the binlog cache is lost, resulting in more logs from the slave database than the master database.

After you reconfigure the master and slave nodes, set sync_binlog to 1.

The importance and significance of sync_binlog:

Sync_binlog = n. After each n transaction commits, MySQL runs a Disk Synchronization command such as fsync to forcibly write data in binlog_cache to the disk.

In MySQL, sync_binlog is set to 0 by default, that is, no mandatory disk refresh command is performed. At this time, the performance is the best, but the risk is also the biggest. Because once the system Crash, all binlog information in binlog_cache will be lost.

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.