• show slave status


    在从库上,使用show slave status,可以查看主从复制状态。
    包括主库定制,IO thread、 SQL thread连接状态,以及bin log位置等。

    >show slave statusG
    *************************** 1. row ***************************
                   Slave_IO_State: Waiting for master to send event
                      Master_Host: sh-dba-mysql-009
                      Master_User: repl
                      Master_Port: 3306
                    Connect_Retry: 10
                  Master_Log_File: mysql-bin.000001
              Read_Master_Log_Pos: 525
                   Relay_Log_File: relay.000002
                    Relay_Log_Pos: 738
            Relay_Master_Log_File: mysql-bin.000001
                 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: 525
                  Relay_Log_Space: 935
                  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: 4092246
                      Master_UUID: 456f3e13-6000-11e8-8bda-002272a443bb
                 Master_Info_File: mysql.slave_master_info
                        SQL_Delay: 0
              SQL_Remaining_Delay: NULL
          Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
               Master_Retry_Count: 86400
                      Master_Bind:
          Last_IO_Error_Timestamp:
         Last_SQL_Error_Timestamp:
                   Master_SSL_Crl:
               Master_SSL_Crlpath:
               Retrieved_Gtid_Set: 456f3e13-6000-11e8-8bda-002272a443bb:1-2
                Executed_Gtid_Set: 456f3e13-6000-11e8-8bda-002272a443bb:1-2
                    Auto_Position: 1
             Replicate_Rewrite_DB:
                     Channel_Name:
               Master_TLS_Version:
    1 row in set (0.00 sec)
    

    Master_Info_File

    其中的选项 Master_Info_File 表示master.info 信息的位置,可以是文件,也可以是数据表。
    Master_Info_File 为 mysql.slave_master_info数据表。

    日志位点信息

    从以上信息中,可以整理出三套日志位点信息。

    选项 说明
    Master_Log_File I/O线程正在读取的主库日志文件
    Read_Master_Log_Pos 在当前的主库日志文件中,I/O线程已经读取的日志位置
    Relay_Log_File SQL线程正在读取和执行的中继日志文件
    Relay_Log_Pos 在当前的中继日志文件中,SQL线程已经读取和执行的中继日志坐标
    Relay_Master_Log_File SQL线程最近执行的事件所在的主库日志文件
    Exec_Master_Log_Pos SQL线程已经读取和执行的主库日志位置

    Last_IO_Errno 和 Last_IO_Error

    Last_IO_Errno 和 Last_IO_Error表示导致IO线程停止的最近的错误码和错误信息。

    错误码为0, 错误信息为空, 表示没有错误。如果IO线程出错,错误信息也会出现从库的错误日志。

    Last_IO_Error_Timestamp

    Last_IO_Error_Timestamp 是最近一次IO 线程出现错误的时间。例如:

    Last_IO_Error_Timestamp: 200129 12:29:28
    

    执行 RESET MASTER 或者 RESET SLAVE会清空这些信息。

    Last_SQL_Errno,和Last_SQL_Error

    表示导致SQL线程停止的最近的错误码和错误信息。
    错误码为0, 错误信息为空, 表示没有错误。如果SQL线程出错,错误信息也会出现从库的错误日志。

    Last_SQL_Errno 和Last_SQL_Error 具体定义见链接B.3.1 Server Error Message Reference

    执行 RESET MASTER 或者 RESET SLAVE会清空这些信息。

    Last_SQL_Error_Timestamp

    是最近一次SQL线程出现错误的时间,格式同IO线程Last_IO_Error_Timestamp 。

    Last_Errno和Last_Error

    Last_Errno和Last_Error 是Last_SQL_Errno 和 Last_SQL_Error 别名。
    执行 RESET MASTER 或者 RESET SLAVE会清空这些信息。

    参考

    13.7.5.34 SHOW SLAVE STATUS Statement
    B.3.1 Server Error Message Reference

  • 相关阅读:
    201771010111 李瑞红 《第十二周学习总结》
    201771010111李瑞红《第十一周学习总结》
    李瑞红201771010111第十周 学习总结
    李瑞红201771010111《第九周学习总结》
    201771010111李瑞红《面向对象的程序设计》第八周实验总结
    2017710101111李瑞红《第七周学习总结》
    李瑞红201771010111《第六周学习总结》
    李瑞红201771010111《面向对象程序设计(java)》第四周学习总结
    201771010113 李婷华《面向对象程序设计(Java)》第十二周总结
    201771010113 李婷华 《面向对象程序设计(Java)》第十一周总结
  • 原文地址:https://www.cnblogs.com/lanyangsh/p/12359532.html
Copyright © 2020-2023  润新知