To check the status of a slave, run the SHOW SLAVE STATUS command.

mysql> SHOW SLAVE STATUS\G;

Something like below will be showing:

*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.0.100
                Master_User: slaveuser_for_s2
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000010
        Read_Master_Log_Pos: 98
             Relay_Log_File: slave-relay.000002
              Relay_Log_Pos: 235
      Relay_Master_Log_File: mysql-bin.000010
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB: exampledb
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error:
               Skip_Counter: 0
        Exec_Master_Log_Pos: 98
            Relay_Log_Space: 235
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: 0
1 row in set (0.01 sec)

It is important that both Slave_IO_Running and Slave_SQL_Running have the value YES in the output.

Slave IO Thread
------------------
Master_Log_File : The name of the binlog file from the master that slave IO thread is “working on”. It is not the name of a relay log on the slave

Read_Master_Log_Pos : The position in the Master_Log_File that the slave IO thread has copied up to.

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


SQL Thread
-------------
Relay_Master_Log_File : The name of the binlog file from the master that SQL thread is “working on”. It is not the name of a relay log on the slave

Exec_Master_Log_Pos : The position in the Relay_Master_Log_File that the slave SQL thread has executed up to.




  • No labels