Documentation Home
MySQL 5.5 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 27.1Mb
PDF (A4) - 27.2Mb
PDF (RPM) - 26.0Mb
HTML Download (TGZ) - 6.5Mb
HTML Download (Zip) - 6.5Mb
HTML Download (RPM) - 5.6Mb
Man Pages (TGZ) - 152.8Kb
Man Pages (Zip) - 254.9Kb
Info (Gzip) - 2.6Mb
Info (Zip) - 2.6Mb
Excerpts from this Manual Slave Status Logs

A replication slave server creates two logs. By default, these logs are files named and and created in the data directory. The names and locations of these files can be changed by using the --master-info-file and --relay-log-info-file options, respectively. See Section 17.1.3, “Replication and Binary Logging Options and Variables”.

The two status logs contain information like that shown in the output of the SHOW SLAVE 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.

The master info log should be protected because it contains the password for connecting to the master. See Section, “Passwords and Logging”.

The slave I/O thread updates the master info log. The following table shows the correspondence between the lines in the file and the columns displayed by SHOW SLAVE STATUS. File LineSHOW SLAVE STATUS ColumnDescription
1 Number of lines in the file
2Master_Log_FileThe name of the master binary log currently being read from the master
3Read_Master_Log_PosThe current position within the master binary log that have been read from the master
4Master_HostThe host name of the master
5Master_UserThe user name used to connect to the master
6Password (not shown by SHOW SLAVE STATUS)The password used to connect to the master
7Master_PortThe network port used to connect to the master
8Connect_RetryThe period (in seconds) that the slave will wait before trying to reconnect to the master
9Master_SSL_AllowedIndicates whether the server supports SSL connections
10Master_SSL_CA_FileThe file used for the Certificate Authority (CA) certificate
11Master_SSL_CA_PathThe path to the Certificate Authority (CA) certificates
12Master_SSL_CertThe name of the SSL certificate file
13Master_SSL_CipherThe list of possible ciphers used in the handshake for the SSL connection
14Master_SSL_KeyThe name of the SSL key file
15Master_SSL_Verify_Server_CertWhether to verify the server certificate
17Replicate_Ignore_Server_IdsThe 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 the file and the columns displayed by SHOW SLAVE STATUS.

Line in relay-log.infoSHOW SLAVE STATUS ColumnDescription
1Relay_Log_FileThe name of the current relay log file
2Relay_Log_PosThe current position within the relay log file; events up to this position have been executed on the slave database
3Relay_Master_Log_FileThe name of the master binary log file from which the events in the relay log file were read
4Exec_Master_Log_PosThe equivalent position within the master's binary log file of events that have already been executed

The contents of the file and the states shown by the SHOW SLAVE STATUS statement might not match if the file has not been flushed to disk. Ideally, you should only view on a slave that is offline (that is, mysqld is not running). For a running system, 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_FILE and 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.

User Comments
Sign Up Login You must be logged in to post a comment.