如何檢查mysql資料庫中mysql複製是否正常工作?

來源:互聯網
上載者:User

標籤:mysql資料庫   資料庫管理員   資料庫工程師   資料庫開發   

通過在slave上執行show slave status來檢查複製是否正常工作

mysql> SHOW SLAVE STATUS\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: master1

Master_User: root

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 931

Relay_Log_File: slave1-relay-bin.000056

Relay_Log_Pos: 950

Relay_Master_Log_File: mysql-bin.000004

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: 931

Relay_Log_Space: 1365

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: 0

Slave_IO_State:代表當前slave的狀態

Slave_IO_Running:代表負責讀取主庫bin log的IO線程是否是運行狀態,正常情況下應

該是YES

Slave_SQL_Running:代表負責執行備庫relay log的SQL線程是否是運行狀態,正常情

況下應該是YES

Last_IO_Error, Last_SQL_Error: 分別代表最後一次IO線程和SQL線程所發生的錯誤,

正常情況下應該是空代表沒有錯誤

Seconds_Behind_Master:代表備庫的SQL線程比主庫的bin log晚多少秒。0代表目前

沒有複寫延遲

(Master_Log_file, Read_Master_Log_Pos):表示IO線程在主庫bin log中的座標位置

(Relay_Master_Log_File, Exec_Master_Log_Pos):表示SQL線程在主庫bin log中的坐

標位置

(Relay_Log_File, Relay_Log_Pos):表示SQL線程在備庫relay log中的座標位置

在主庫可以通過執行show processlist命令查看主庫的bin log日誌產生進程

mysql> SHOW PROCESSLIST \G;

*************************** 4. row ***************************

Id: 10

User: root

Host: slave1:58371

db: NULL

Command: Binlog Dump

Time: 777

State: Has sent all binlog to slave; waiting for binlog to be updated

Info: NULL

互連網企業大多用的資料庫是MySQL的,想要眾多的IT工作者中脫穎而出,就需要擁有高深的技術,學習增值是必不可少的。學習之路,是貴在堅持的。老男孩教育MySQL DBA課程,幾經更新課程,杜絕紙上談兵,全企業真實案例結合理論授課,想深入的學習MySQL DBA的知識,可以關注下老男孩教育。


如何檢查mysql資料庫中mysql複製是否正常工作?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.