2017-10-17 111 views
0

兩天前,我通過master上的「source xxx.sql」導入數據,它有135萬行記錄,總大小爲10G,主控任何東西我執行導入操作後是好的。但是它在主人已經完成了兩天,奴隸的狀態仍然是「從接力日誌中讀取事件」,誰能幫我解決問題?提前致謝。mysql slave始終在繼續日誌的閱讀事件

下面是關於從狀態細節:

mysql> show slave status\G 
*************************** 1. row *************************** 
       Slave_IO_State: Waiting for master to send event 
        Master_Host: 192.168.1.50 
        Master_User: repl 
        Master_Port: 3306 
       Connect_Retry: 60 
       Master_Log_File: mysql-bin.001137 
      Read_Master_Log_Pos: 43132410 
       Relay_Log_File: mysql-relay-bin.002897 
       Relay_Log_Pos: 497809898 
     Relay_Master_Log_File: mysql-bin.001130 
      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: 497809685 
       Relay_Log_Space: 40113924576 
       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: 161225 
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: 0f9e9ec5-ed9f-11e5-9a4a-525400c50c20 
      Master_Info_File: /data/mysql1/master.info 
        SQL_Delay: 0 
      SQL_Remaining_Delay: NULL 
     Slave_SQL_Running_State: Reading event from the relay log 
      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: 
       Auto_Position: 0 
     Replicate_Rewrite_DB: 
       Channel_Name: 
      Master_TLS_Version: 
1 row in set (0.00 sec) 

下面是對藥膏中繼日誌列表:

-rw-r----- 1 mysql mysql 254 Oct 15 11:17 mysql-relay-bin.002896 
-rw-r----- 1 mysql mysql 19G Oct 15 11:40 mysql-relay-bin.002897 
-rw-r----- 1 mysql mysql 161K Oct 15 11:40 mysql-relay-bin.002898 
-rw-r----- 1 mysql mysql 254 Oct 15 11:40 mysql-relay-bin.002899 
-rw-r----- 1 mysql mysql 67M Oct 15 12:10 mysql-relay-bin.002900 
-rw-r----- 1 mysql mysql 18G Oct 15 12:14 mysql-relay-bin.002901 
-rw-r----- 1 mysql mysql 112K Oct 15 12:14 mysql-relay-bin.002902 
-rw-r----- 1 mysql mysql 254 Oct 15 12:14 mysql-relay-bin.002903 
-rw-r----- 1 mysql mysql 420 Oct 15 12:14 mysql-relay-bin.002904 
-rw-r----- 1 mysql mysql 4.4M Oct 15 12:14 mysql-relay-bin.002905 
-rw-r----- 1 mysql mysql 254 Oct 15 12:14 mysql-relay-bin.002906 
-rw-r----- 1 mysql mysql 420 Oct 15 12:14 mysql-relay-bin.002907 
-rw-r----- 1 mysql mysql 254 Oct 15 12:14 mysql-relay-bin.002908 
-rw-r----- 1 mysql mysql 122M Oct 15 14:34 mysql-relay-bin.002909 
-rw-r----- 1 mysql mysql 207 Oct 15 14:34 mysql-relay-bin.002910 
-rw-r----- 1 mysql mysql 7.9M Oct 15 15:27 mysql-relay-bin.002911 
-rw-r----- 1 mysql mysql 207 Oct 15 15:27 mysql-relay-bin.002912 
-rw-r----- 1 mysql mysql 371K Oct 15 15:34 mysql-relay-bin.002913 
-rw-r----- 1 mysql mysql 207 Oct 15 15:34 mysql-relay-bin.002914 
-rw-r----- 1 mysql mysql 76M Oct 15 23:00 mysql-relay-bin.002915 
-rw-r----- 1 mysql mysql 5.3M Oct 15 23:59 mysql-relay-bin.002916 
-rw-r----- 1 mysql mysql 254 Oct 15 23:59 mysql-relay-bin.002917 
-rw-r----- 1 mysql mysql 36M Oct 16 08:05 mysql-relay-bin.002918 
-rw-r----- 1 mysql mysql 4.4M Oct 16 08:22 mysql-relay-bin.002919 
-rw-r----- 1 mysql mysql 979M Oct 16 23:00 mysql-relay-bin.002920 
-rw-r----- 1 mysql mysql 5.5M Oct 16 23:58 mysql-relay-bin.002921 
-rw-r----- 1 mysql mysql 254 Oct 16 23:58 mysql-relay-bin.002922 
-rw-r----- 1 mysql mysql 38M Oct 17 08:02 mysql-relay-bin.002923 
-rw-r----- 1 mysql mysql 6.6M Oct 17 08:53 mysql-relay-bin.002924 
-rw-r----- 1 mysql mysql 725 Oct 17 08:02 mysql-relay-bin.index 

回答

1

見從屬狀態輸出Seconds_Behind_Master: 161225 線,現在延遲44小時。

運行show slave status幾次,並提出它的變化率,如果一切正常,它應該不斷減少。

要加速從屬,您可以減少服務器上的負載:停止查詢一段時間,並停止發生在服務器上的任何其他活動。

然而,你可能會發現合理的重新設置從主從新的轉儲奴隸,從percona的xtrabackup可以做到沒有鎖到數據庫(除非你使用MyISAM很多,因爲它最適合innodb引擎)。