A replication slave server creates two logs. By default, these
logs are files named
relay-log.info and created in the data
directory. The names and locations of these files can be changed
by using the
options, respectively. See
Section 17.1.3, “Replication and Binary Logging Options and Variables”.
The two status logs contain information similar to that shown in
the output of the
STATUS statement, which is discussed in
Section 13.4.2, “SQL Statements for Controlling Slave Servers”. Because the status logs
are stored on disk, they survive a slave server's shutdown.
The next time the slave starts up, it reads the two logs to
determine how far it has proceeded in reading binary logs from
the master and in processing its own relay logs.
Access to the master info log should be restricted because it contains the password for connecting to the master. See Section 126.96.36.199, “Passwords and Logging”.
The slave I/O thread updates the master info log. The following
table shows the correspondence between the lines in the
master.info file and the columns displayed
SHOW SLAVE STATUS.
|1||Number of lines in the file|
||The name of the master binary log currently being read from the master|
||The current position within the master binary log that have been read from the master|
||The host name of the master|
||The user name used to connect to the master|
|6||Password (not shown by
||The password used to connect to the master|
||The network port used to connect to the master|
||The period (in seconds) that the slave will wait before trying to reconnect to the master|
||Indicates whether the server supports SSL connections|
||The file used for the Certificate Authority (CA) certificate|
||The path to the Certificate Authority (CA) certificates|
||The name of the SSL certificate file|
||The list of possible ciphers used in the handshake for the SSL connection|
||The name of the SSL key file|
||Whether to verify the server certificate|
||The number of server IDs to be ignored, followed by the actual server IDs|
The slave SQL thread updates the relay log info log. The
following table shows the correspondence between the lines in
relay-log.info file and the columns
SHOW SLAVE STATUS.
||The name of the current relay log file|
||The current position within the relay log file; events up to this position have been executed on the slave database|
||The name of the master binary log file from which the events in the relay log file were read|
||The equivalent position within the master's binary log file of events that have already been executed|
The contents of the
relay-log.info file and
the states shown by the
STATUS statement might not match if the
relay-log.info file has not been flushed to
disk. Ideally, you should only view
relay-log.info on a slave that is offline
mysqld is not running). For a
SHOW SLAVE STATUS
should be used.
When you back up the slave's data, you should back up these
two status logs, along with the relay log files. The status logs
are needed to resume replication after you restore the data from
the slave. If you lose the relay logs but still have the relay
log info log, you can check it to determine how far the SQL
thread has executed in the master binary logs. Then you can use
CHANGE MASTER TO with the
MASTER_LOG_POS options to tell the slave to
re-read the binary logs from that point. Of course, this
requires that the binary logs still exist on the master.