Replication Relay and Status Logs
1478
16.2.2. Replication Relay and Status Logs
During replication, a slave server creates several logs that hold the binary log events relayed from the
master to the slave, and to record information about the current status and location within the relay log.
There are three types of logs used in the process, listed here:
• The relay log consists of the events read from the binary log of the master and written by the slave I/
O thread. Events in the relay log are executed on the slave as part of the SQL thread.
• The master info log contains status and current configuration information for the slave's connection
to the master. This log holds information on the master host name, login credentials, and coordinates
indicating how far the slave has read from the master's binary log.
• The relay log info log holds status information about the execution point within the slave's relay log.
16.2.2.1. The Slave Relay Log
The relay log, like the binary log, consists of a set of numbered files containing events that describe
database changes, and an index file that 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 have the same format as binary log files and can be read using
mysqlbinlog
(see
Section 4.6.7, “
mysqlbinlog
— Utility for Processing Binary Log Files”
).
By default, relay log file names have the form
host_name-relay-bin.nnnnnn
in the data
directory, where
host_name
is the name of the slave server host and
nnnnnn
is a sequence number.
Successive relay log files are created using successive sequence numbers, beginning with
000001
.
The slave uses an index file to track the relay log files currently in use. The default relay log index file
name is
host_name-relay-bin.index
in the data directory.
The default relay log file and relay log index file names can be overridden with, respectively, the
--relay-log
[1455]
and
--relay-log-index
[1455]
server options (see
Section 16.1.2,
“Replication and Binary Logging Options and Variables”
).
If a slave uses the default host-based relay log file names, changing a slave's host name after
replication has been set up can cause replication to fail with the errors
Failed to open the
relay log
and
Could not find target log during relay log initialization
. This
is a known issue (see Bug #2122). If you anticipate that a slave's host name might change in the
future (for example, if networking is set up on the slave such that its host name can be modified using
DHCP), you can avoid this issue entirely by using the
--relay-log
[1455]
and
--relay-log-
index
[1455]
options to specify relay log file names explicitly when you initially set up the slave. This
will make the names independent of server host name changes.
If you encounter the issue after replication has already begun, one way to work around it is to stop the
slave server, prepend the contents of the old relay log index file to the new one, and then restart the
slave. On a Unix system, this can be done as shown here:
shell>
cat new_relay_log_name.index >> old_relay_log_name.index
shell>
mv old_relay_log_name.index new_relay_log_name.index
A slave server creates a new relay log file under the following conditions:
• Each time the I/O thread starts.
• When the logs are flushed; for example, with
FLUSH LOGS
or
mysqladmin flush-logs
.
• When the size of the current relay log file becomes “too large,” determined as follows:
• If the value of
max_relay_log_size
[470]
is greater than 0, that is the maximum relay log file
size.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...