原本主数据库上的二进制文件每小时新建一个,但不知道由于什么原因(批量处理数据导致?数据库一直在读写中),二进制文件一直在增大,mysql-bin.01045到了100多M,大概从这个日志文件的中间数据就同步不过去了,但状态信息一直显示正常。我用flush log新建了日志文件,主数据库的日志文件更新到了mysql-bin.01046,但从数据库数据还是过不去,目前主从状态信息如下,请大家帮忙分析。多谢mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 119.254.3.10
                  Master_User: admin
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.010456
          Read_Master_Log_Pos: 4782657
               Relay_Log_File: localhost-relay-bin.000932
                Relay_Log_Pos: 72340246
        Relay_Master_Log_File: mysql-bin.010455
             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: 72340101
              Relay_Log_Space: 107567243
              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: 13092
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)mysql> show master status\G
*************************** 1. row ***************************
            File: mysql-bin.010456
        Position: 4816780
    Binlog_Do_DB: CDN
Binlog_Ignore_DB:
1 row in set (0.00 sec)

解决方案 »

  1.   

    贴slave上得show processlist;看一下,应该有个复制进程里的sql在一直没有执行完
      

  2.   

    show processlist;
    +--------+-------------+-----------+------+---------+---------+----------------------------------+----------------------------------
    --------------------------------------------------------------------+
    | Id     | User        | Host      | db   | Command | Time    | State                            | Info
                                                                        |
    +--------+-------------+-----------+------+---------+---------+----------------------------------+----------------------------------
    --------------------------------------------------------------------+
    | 490182 | system user |           | NULL | Connect | 1970873 | Waiting for master to send event | NULL
                                                                        |
    | 490183 | system user |           | CDN  | Connect |   13697 | Copying to tmp table             | insert into user_day_traffic sele
    ct 'admin' as user_id, b.log_date, c.avg_traffic as max_traffic, d. |
    | 717737 | root        | localhost | CDN  | Query   |       0 | NULL                             | show processlist
                                                                        |
    | 721948 | root        | localhost | CDN  | Sleep   |    3994 |                                  | NULL
                                                                        |
    +--------+-------------+-----------+------+---------+---------+----------------------------------+----------------------------------
    --------------------------------------------------------------------+
    4 rows in set (0.00 sec)
      

  3.   

    这种未执行完的怎么办,怎么让程序执行下去。
    重启slave服务?怎么找到MASTER_LOG_POS
      

  4.   

    Seconds_Behind_Master: 13092
    延迟这么长时间了,SLAVE把BINLOG从MASTER拉过后,还原成SQL语句,一条条执行。你现在延迟这么大,所以看到的SLAVE数据没有更新,其实复制是正常的,你只需要静静的等待,哈,