How to avoid corrupted binlogs on MySQL
To avoid corrupted binlogs on the MySQL, enabling sync_binlog=1 on MySQL helps in most cases. sync_binlog=1 will synchronize the binary log to disk after every commit. sync_binlog makes MySQL perform on fsync on the binary log in addition to the fsync by InnoDB. As a reminder, it has some cost impact as it will synchronize the write-to-binary log on disk after every commit. On the other hand, sync_binlog=1 overhead can be very minimal or negligible if the disk subsystem is SSD along with battery-backed cache (BBU). You can read more about this here in the manual.
sync_binlog is a dynamic option that you can enable on the fly. Here’s how:
sync_binlog is a dynamic option that you can enable on the fly. Here’s how:
To make the change persistent across reboot, you can add this parameter in my.cnf.
Comments
Post a Comment