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

Realy_log_recovery of MySQL master-slave replication

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This parameter is turned on by default and starts automatic relay log recovery immediately after the database is started. During the recovery process, create a new relay log and initialize the IO thread to the location of the SQL thread.

During the operation of MySQL, if there is a downtime, it must be able to recover to the location where the transaction has been executed after starting the library. This information is traditionally stored in the file, so there may be a risk of inconsistency or corruption for a long time. Starting with MySQL5.7, you can use tables to store this information, concurrently these tables are set as InnoDB engines, and recover this information by using a transactional storage engine. You can configure the parameters master_info_repository=table and relay_log_info_repository=table to store slave library information in a table. How the library recovers from the down state to the correct state depends on whether the slave library is single-threaded or multithreaded, the value of the relay_log_recover parameter, and how master_auto_position is used.

1. Replication in single-thread mode

1) when replication is based on GTID mode, and the master_auto_position parameter and relay_log_recover=0 are set, using this configuration, the settings of relay_log_info_repository and other variables will not affect the recovery.

2) when based on the traditional mode (file position), set relay_log_recover=1 and relay_log_info_repository=table.

2. Replication of multithreading mode

1) when replication is based on GTID mode, and master_auto_position and relay_log_recovery=0 are set, using this configuration, the settings of relay_log_info_reposition and other variables will not affect the recovery.

2) when replicating based on traditional mode, set relay_log_recovery=1, sync_relay_log=1, and relay_log_info_repository=table.

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