Trying to understand SHOW SLAVE STATUS in MySQL

I want to understand further is the Relay_Log_File, Relay_Log_Pos and Relay_Master_Log_File.

From SHOW SLAVE STATUS\G, get two values

  • Relay_Log_File : Current relay log accepting new entries during replication
  • Relay_Log_Pos : Current position of the current relay log accepting new entries during replication
  • Relay_Master_Log_File : Relay log file containing the last successfully executed SQL statement on the Master that was executed on the Slave.
  • Master_Log_File : The log on the Master that corresponds to the current relay log file and current relay log position

The files are in binary so not able to view them right

Yes, you can view the relay logs. Since they have the same structure as a regular binary log, just run the mysqlbinlog program. For example to view the SQL within any of you relay logs, such as the last one, do this:

mysqlbinlog mysqld-relay-bin.000056 > /root/SQLForCurrentRelayLog.txt
less /root/SQLForCurrentRelayLog.txt

Relay_Master_Log_File is actually the name of the binlog on the master containing the last SQL statement successfully executed on the slave. It is not the name of a relay log on the slave. See:

Exec_Master_Log_Pos is the position in the relay_master_log_file that the slave SQL thread has executed up to. So in your example, the slave db has executed all statements up until binlog mysql-bin.000001 pos 10726644 on the master db.

until_log_pos is really only used if you start your slave with the syntax START SLAVE UNTIL master_log_pos = $integer. That syntax will replicate up to that position (it will be the exec_master_log_pos) and then stop. You would normally only do this if you wanted to replicate to a specific point, but no further (like if the next statement is an accidental table drop or something). The value of until_log_pos is 0 when it is not specified, so in your case means that replication will just keep moving forward.