show slave status 詳解 【MySQL5.7】
- 2019 年 10 月 4 日
- 筆記
以MySQL5.7.19為例,部分重要的地方用紅色標註了。
>show slave statusG *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 172.16.10.12 Master_User: rpl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000032 #正在讀取的主庫的binlog文件名【反映從庫IO_thread執行進度】 Read_Master_Log_Pos: 1717 #正在讀取到的主庫的pos【反映從庫IO_thread執行進度】 Relay_Log_File: node1-relay-bin.000012 Relay_Log_Pos: 320 Relay_Master_Log_File: mysql-bin.000032 #正在執行到的主庫上的binlog文件名【反映從庫SQL_thread執行進度】 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: 1717 # 當前執行到的主庫的pos【反映從庫SQL_thread執行進度】 Relay_Log_Space: 6907 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: 3306 Master_UUID: e00b1731-a383-11e7-ada1-000c29c99d23 Master_Info_File: mysql.slave_master_info #表示slave複製的進度是寫表存儲的,而不是寫文件存儲 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: Executed_Gtid_Set: 770c8eb0-9f38-11e7-9b59-000c29c99d23:1-97, e00b1731-a383-11e7-ada1-000c29c99d23:1-648 Auto_Position: 0 Replicate_Rewrite_DB: # 5.7支援動態的設置複製映射 Channel_Name: #5.7支援通過不同的channel_name來實現多源複製 Master_TLS_Version:
關於Seconds_Behind_Master的解釋:
其值是通過將伺服器當前的時間戳與二進位日誌中的事件的時間戳相對比得到的【MySQL手冊上說的是從庫SQL執行緒與IO執行緒所處理的最近的日誌事件的時間戳差】。
只有在執行事件時才能報告延遲。
如果備庫複製執行緒沒有啟動,就會報延遲為NULL。
補充,RESET命令的用法:
1 RESET MASTER:
刪除全部的binlog文件,重置mysql.index文件為空,然後重新生成一個binlog文件。
2 RESET QUERY CACHE:
刪除查詢快取。
3 RESET SLAVE:
使從節點忘記它當前複製的位置,它會刪除當前的relay log文件,對新的relay-log文件從0開始重新編號,但是不會改變 change master to的配置參數(這些參數是在記憶體中的)。
4 RESET SLAVE ALL:
是在reset slave的基礎上,進一步重置了chagne master to的參數。這樣的話,show slave statusG就沒有顯示。