Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Binlog_format of master-slave replication

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are three main formats of binlog_format: statement, row, mixed

Binlog_format=statement

Master writes the executed SQL statements to binlog, reads these SQL statements from the library and executes them. This replication method based on SQL statements is the earliest replication method supported by MySQL.

Binlog_format=mixed

Master's binlog_format can be configured to use a combination of both statement and row, which logs depending on the type of modification, and choose the appropriate format to record the change. Logs are recorded in statement format by default, and are converted to records based on row format in specific cases.

Binlog_format=row

After the MySQL5.7.7 version, change the default value of binlog_format to row,master to write the event of the modified table to binlog, and master sends the binlog to the event in the slave,slave playback binlog. The safest replication is based on row format, and slave requires fewer row locks. The disadvantage is that binlog records more data in row format, because it's all event. However, the binlog_rows_query_log_events parameter can be opened in row format, and binlog records the original SQL statement while recording the events, which is convenient for future query and audit.

It is recommended to use row format during replication. Other formats may cause inconsistencies between master and slave data.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report