17.2.2.2 slave status logs
複制slave server 建立2個日志,預設的,這些日檔案命名為master.info 和relay-log.info,
在資料目錄下。 名字和檔案的位置 可以通過 –master-info-file and –relay-log-info-file options改變,
在mysql 5.6以後, 兩者都可以寫入到tables 通過設定相應的選項:
使用–master-info-repository 讓master info log寫入到 mysql.slave_master_info table,
使用–relay-log-info-repository to have the relay log info log written to the mysql.slave_relay_log_info table.
兩種狀态日志 包含show slave status語句的資訊, 因為狀态資訊被存儲在磁盤,
它們在server 關閉後存活下來。 下一次slave啟動時,它讀取兩個日志來決定 slave已經處理在從master 讀取
binary log 的資訊和處理它自己的relay logs.
master info log 檔案或者表 應該被保護,因為它包含了密碼用于連接配接到master.
slave i/o thread 更新master info log
slave sql thread更新relay log info log,在mysql 5.6,relay-log.info 檔案包含行數和複制延遲值
mysql 5.6之前,relay-log.info 檔案不包含行數或者延遲值
注意:
如果你降低一個slave server的版本老于mysql 5.6, 老的server 不直接讀取relay-log.info 檔案。
為了解決這個問題, 在一個文本編輯器中修改該檔案,通過删除包含行數的初始行。
relay-log.info 檔案的内容 和狀态資訊通過show slave status語句不能比對,
如果relay-log.info 檔案沒有被重新整理到磁盤。 理想情況下,你隻需要檢視relay-log.info 在一個沒有運作的slave上,
對于一個運作的系統,你可以使用show slave status,或者查詢slave_master_info和slave_relay_log_info表
如果你寫狀态資訊到表裡。