1)基于二進制日志復制的顯示格式
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 172.18.16.22
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.010362
Read_Master_Log_Pos: 555176471
Relay_Log_File: mysqld-relay-bin.004136
Relay_Log_Pos: 502564
Relay_Master_Log_File: mysql-bin.010327
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: blog
Replicate_Ignore_DB:
Replicate_Do_Table: blog.archives
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 555176471
Relay_Log_Space: 3642164873
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: 1042
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: 1622
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
參數具體含義解釋:
Slave_IO_State
這個是指Slave連接到Master的狀態,就是當前IO線程的狀態,MySQL主從復制線程狀態轉變。
Master_User
這個是Master上面的一個用戶,用來負責主從復制的用戶 ,創建主從復制的時候建立的(具有reolication slave權限)。
Master_Port
Master服務器的端口,一般是3306。
Connect_Retry
連接嘗試次數,使用change master時可以使用master-connect-retry選項指定當前值。
Master_Log_File
顯示當前I/O線程當前正在讀取的主服務器二進制日志文件的名稱,上面顯示是mysql-bin.010362。
Read_Master_Log_Pos
顯示當前同步到主服務器上二進制日志的偏移量,I/O線程已經讀取的位置,單位是字節,上述的示例顯示當前同步到mysql-bin.010362的555176471偏移量位置,即已經同步了mysql-bin.010362這個二進制日志中529MB(555176471/1024/1024)的內容。
Relay_Log_File
顯示Slave的SQL線程當前正在讀取和執行的中繼日志文件的名稱。
Relay_Log_Pos
顯示在當前的中繼日志中,Slave的SQL線程已讀取和執行的中繼日志的偏移量。
Relay_Master_Log_File
顯示Slave中繼日志同步到Master的二進制日志文件,本示例中為mysql-bin.010327。
Slave_IO_Running
顯示I/O線程是否被啟動并成功地連接到主服務器上,成功為Yes,否則為No。
Slave_SQL_Running
顯示SQL線程是否被啟動,啟動為Yes,否則為No。
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
這些參數都是為了用來指明哪些庫或者表在復制的時候不要同步到備庫,但是這些參數用的時候要小心,因為當跨庫使用的時候可能會出現問題。另外當僅忽略或僅允許多個庫或表時,要多次使用忽略語句才可以。
Last_Errno,Last_Error
顯示Slave的SQL線程讀取日志參數的的錯誤數量和錯誤消息,錯誤數量為0并且消息為空字符串表示沒有錯誤;如果Last_Error值不是空值,它也會在從屬服務器的錯誤日志中作為消息顯示。
Skip_Counter
顯示最近被使用的用于SQL_SLAVE_SKIP_COUNTER的值,就是用于跳過Slave錯誤的。
Exec_Master_Log_Pos
表示SQL線程執行的Relay log相對于主庫二進制日志偏移量的位置,Read_Master_Log_Pos減去Exec_Master_Log_Pos可以表示當前SQL線程運行的延時,單位是字節。上述例子顯示完全同步。注意還要看Relay_Master_Log_File的值是否跟Master_Log_File相同,如果小于Master_Log_File二進制,則說明延遲更大。
Relay_Log_Space
表示所有原有的中繼日志結合起來的總大小,在START SLAVE語句的UNTIL子句中指定的值,Until_Condition具有以下值:Until_Condition、Until_Log_File、Until_Log_Pos。
Until_Condition
如果沒有指定UNTIL子句,則沒有值。如果從屬服務器正在讀取,直到達到主服務器的二進制日志的給定位置為止,則值為Master,如果從屬服務器正在讀取,直到達到其中繼日志的給定位置為止,則值為Relay。
Until_Log_File
Until_Log_Pos
Until_Log_File和Until_Log_Pos用于指示日志文件名和位置值,日志文件名和位置值定義了SQL線程在哪個點中止執行。
Master_SSL_Allowed
顯示了從服務器是否使用SSL連接到主服務器。如果允許對主服務器進行SSL連接,則值為Yes;如果不允許對主服務器進行SSL連接,則值為No;如果允許SSL連接,但是從服務器沒有讓SSL支持被啟用,則值為Ignored。
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
如果Slave使用SSL連接Master服務器,這里就會顯示對應的證書和私鑰信息。使用CHANGE MASTER與SSL相關的選項有:–master-ca,–master-capath,–master-cert,–master-cipher和–master-key等。
Seconds_Behind_Master
表示主從之間延遲的時間,單位是秒。如果為null表示未知數,一般主從復制出問題了會出現null的情況。
Master_SSL_Verify_Server_Cert
顯示是否認證Master證書。
Master_Server_Id
顯示主服務器的Server_id。
Using_Gtid
表示是否開啟了基于Gtid的復制,開啟為Yes,否則為No。
Gtid_IO_Pos
如果開啟了基于Gtid的復制,這里會顯示當前執行到的事物ID。
2)基于GTIDs復制的顯示格式
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.30.65
Master_User: mysql_slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 790
Relay_Log_File: relay-log.000008
Relay_Log_Pos: 1003
Relay_Master_Log_File: mysql-bin.000003
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: 790
Relay_Log_Space: 2591
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: 1
Master_UUID: 5f0b7791-a499-11e6-901c-44a84227448b
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: 5f0b7791-a499-11e6-901c-44a84227448b:2-11
Executed_Gtid_Set: 3ec6f284-a4a8-11e6-a3fe-44a84220797c:1-4,5f0b7791-a499-11e6-901c-44a84227448b:1-11
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_UUID
記錄Master的UUID。
Master_Info_File
記錄Master info信息的存儲位置。
SQL_Delay
記錄Slave設置延遲復制的時間,0表示無延遲。
SQL_Remaining_Delay
Slave_SQL_Running_State
記錄SQL線程的狀態。
Last_IO_Error_Timestamp
記錄最近IO線程錯誤的時間戳。
Last_SQL_Error_Timestamp
記錄最近SQL線程錯誤的時間戳。
Retrieved_Gtid_Set
接收的二進制日志集合,對應IO線程。
execute_Gtid_Set
執行的二進制日志集合,對應SQL線程。
Auto_Position
記錄在GTID模式下是否開啟了自動事務校驗。
Channel_Name
在多源復制下(5.7支持),復制通道的名稱,可以有多個。
原文摘自:http://www.ywnds.com/?p=3826&viewuser=39