MySQL Relay log parameter summary

Source: Internet
Author: User
Tags log log

This document summarizes the definitions and explanations of the relevant parameters, which are generated by the relay log in the directory under the configuration file in the main master or master copy of MySQL.

1. What is relay log

The relay log, like the binary log, consists of a set of numbered files containing events, describe database changes, and an index file, the contains the names of all used relay log files.

The term "relay log file" generally denotes an individual numbered file containing database events. The term "relay Log" collectively denotes the set of numbered relay log files plus the index file.

Relay log files has the same format as binary log files and can be read using mysqlbinlog .

Understand: Relay log many aspects are similar to binary log, the difference is: from the server I/O thread to read the primary server's binary log to the local file from the server, then the SQL thread will read the contents of the Relay-log log and apply to the slave server.

2, relay log of the relevant parameters

Mysql>Show variables like '%relay%';+---------------------------+----------------------------------------------+|Variable_name|Value|+---------------------------+----------------------------------------------+|Max_relay_log_size| 0                                            ||Relay_log| /Data01/Mysql_dir/Data/Mysql-Relay-Bin||Relay_log_basename| /Data01/Mysql_dir/Data/Mysql-Relay-Bin||Relay_log_index| /Data01/Mysql_dir/Data/Mysql-Relay-Bin.Index ||Relay_log_info_file| /Data01/Mysql_dir/Data/Mysql-Relay-Bin.info||Relay_log_info_repository| TABLE                                        ||Relay_log_purge|  on                                           ||Relay_log_recovery|  on                                           ||Relay_log_space_limit| 0                                            ||Sync_relay_log| 10000                                        ||Sync_relay_log_info| 10000                                        |+---------------------------+----------------------------------------------+ OneRowsinch Set(0.00Sec

2.1 Max_relay_log_size: Marks the maximum allowable value of relay log, if the value is 0, the default value is Max_binlog_size (1G), and if not 0, Max_relay_log_size is the largest relay_ log file size;

2.2 Relay_log: Defines the location and name of the Relay_log, if the value is empty, the default location is in the directory of the data file, the file name is host_name-relay-bin.nnnnnn (by default, relay log file names The form host_name-relay-bin.nnnnnn in the data directory);

2.3 Relay_log_index: With Relay_log, define the location and name of the Relay_log;

2.4 Relay_log_info_file: Sets the location and name of the Relay-log.info (Relay-log.info records the recovery location and binary_log location of the relay_log of the master), You can also configure logging to the Slave_relay_log_info table in the MySQL library;

2.5 Relay_log_purge: If automatic emptying is no longer required when relaying logs. The default value is 1 (enabled).

2.6 Relay_log_recovery: When the slave from the library down, if the relay-log damage, causing some of the relay log is not processed, then automatically discard all the Relay-log, and re-get the log from master. This guarantees the integrity of the relay-log. By default, this feature is turned off and the value of Relay_log_recovery is set to 1 o'clock, and it is recommended to turn on the slave from the library. When this parameter is turned on, remember to turn onrelay-log-purge参数。

This variable also interacts with Relay-log-purge, which controls purging the logs when they is no longer needed.  Enabling the--relay-log-recovery option when relay-log-purge are disabled risks reading the relay log from files that were Not purged, leading to data inconsistency, and was therefore not crash-safe.

2.7 Relay_log_space_limit: To prevent the trunk log from filling the disk, set the maximum trunk log limit here. But this setting exists the main library crashes, from the library trunk log is not the case, not the last resort, not recommended to use;

2.8 Sync_relay_log: This parameter is the same as Sync_binlog, when set to 1 o'clock, the slave I/O thread receives the Binlog log sent by master every time it is written to the system buffer, and then brushes in the relay log relay log. This is the safest, because at the time of the crash, you will lose at most one transaction, but it will cause a large amount of I/O to the disk. When set to 0 o'clock, it is not immediately brushed into the trunk log, but is determined by the operating system when to write, although the security is reduced, but reduced a lot of disk I/O operations. This value is 10000 by default and can be modified dynamically, with default values recommended.

2.9 Sync_relay_log_info: This parameter is the same as the Sync_relay_log parameter, when set to 1 o'clock, the slave I/O thread receives the Binlog log sent by master every time it is written to the system buffer. Then swipe into the relay-log.info, which is the safest, because at the time of the crash, you will lose at most one transaction, but it will cause a large amount of I/O to the disk. When set to 0 o'clock, it is not immediately brushed into the relay-log.info, but is determined by the operating system when to write, although the security is reduced, but reduced a lot of disk I/O operations. This value is 10000 by default and can be modified dynamically, with default values recommended.

Reference:

Http://www.linuxidc.com/Linux/2014-11/109032.htm

Http://dev.mysql.com/doc/refman/5.7/en/slave-logs-relaylog.html

Http://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html

MySQL Relay log parameter summary

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.