show slave status

Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.1.1.1
                  Master_User: rep_user
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: binlog.000026
          Read_Master_Log_Pos: 446
               Relay_Log_File: relay.000008
                Relay_Log_Pos: 589
        Relay_Master_Log_File: binlog.000026
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          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: 446
              Relay_Log_Space: 878
              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
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 2211
 
Master_Log_File: binlog.000026,对应读取的master二进制文件
Read_Master_Log_Pos: 446        读到了哪个位置
Relay_Master_Log_File: binlog.000026 重放的二进制文件,对应master二进制文件
Exec_Master_Log_Pos: 446 重放到了哪个位置
Relay_Log_File: relay.000008         保存的中继日志
Relay_Log_Pos: 589                   读取中继日志,到了哪个位置
Slave有两个线程,I/O线程从Master接收二进制日志文件,写入本地的中继日志,SQL线程,读取中继日志,重放。典型的生产者/消费者模型。
中继日志有三个位置:I/O从Master读到了哪个位置,SQL执行中继日志,执行到了哪个位置,重放之后,会有一个位置对应Master上面的二进制文件位置。
Read_Master_Log_Pos和Exec_Master_Log_Pos相等,说明没有需要重放的内容了。
Read_Master_Log_Pos与Master 上面的show master status 位置相等,说明没有需要读取的内容,二者已经完全同步。
特别注意:Seconds_Behind_Master不是表示Slave比Master落后多少,而是对于SQL线程,中继日志中还有多少没有执行。
Seconds_Behind_Master=0 不表示Slave与Master完全同步,而是中继日志执行完了。要判断是否完全同步,还需要判断Master记录到了哪个位置和Slave读到了哪个位置。
注:在Master可以并发的查询,但是在Slave只能串行执行,因为Slave只有一个SQL线程重放中继日志,这会成为瓶颈。
原文地址:https://www.cnblogs.com/nzbbody/p/4391788.html