mysql slave始终从中继日志中停留在Reading事件中

时间:2017-10-17 01:24:44

标签: mysql slave

两天前,我通过主机上的“源xxx.sql”导入数据,它有135万行记录,总大小为10G,执行后导入操作后主人有什么好处。但它已经完成了主人已经过了两天,奴隶的状态仍然是“从继电器日志中读取事件”,谁能帮我解决问题?提前感谢。

以下是有关奴隶状态的详细信息:

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)

下面是salve上的中继日志列表:

-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 个答案:

答案 0 :(得分:0)

查看Seconds_Behind_Master: 161225 从站状态输出中的行,现在延迟是44小时。

运行show slave status几次并就其变化的速率提出建议,如果一切正常,它应该不断减少。

要加速从属设备,您可以减少服务器上的负载:停止查询一段时间并停止在服务器上发生的任何其他活动。

然而,您可能会发现从主服务器的新转储中重置从服务器是合理的,来自percona的xtrabackup可以在没有锁定到DB的情况下执行此操作(除非您使用MyISAM,因为它最适合innodb引擎)。