MySQL 从服务器未复制

MySQL 从服务器未复制

我删除了主 mysql 上的一些数据。查看从属状态,显示以下内容:

mysql> show slave status \G;
*************************** 1. row ***************************
           Slave_IO_State: Waiting for master to send event
              Master_Host: 66.x.y.z
              Master_User: repl
              Master_Port: 53308
            Connect_Retry: 60
          Master_Log_File: mysqllog.000002
      Read_Master_Log_Pos: 20341461
           Relay_Log_File: relay.000004
            Relay_Log_Pos: 252
    Relay_Master_Log_File: mysqllog.000002
         Slave_IO_Running: Yes
        Slave_SQL_Running: Yes
          Replicate_Do_DB:
      Replicate_Ignore_DB:
       Replicate_Do_Table:
   Replicate_Ignore_Table:
  Replicate_Wild_Do_Table: test.%
Replicate_Wild_Ignore_Table:
               Last_Errno: 0
               Last_Error:
             Skip_Counter: 0
      Exec_Master_Log_Pos: 20341461
          Relay_Log_Space: 1904953
          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:
         Master_Server_Id: 1
1 row in set (0.00 sec)

ERROR:No query specified

注意 Read_Master_Log_Pos 和 Relay_Log_Pos 之间的巨大差距。Ranshow processlist其中一个线程是这样的:

    Id: 45
  User: system user
  Host:
    db: NULL
Command: Connect
 Time: 297
 State: Slave has read all relay log; waiting for the slave I/O thread to update it
 Info: NULL

师父說...

mysql> show master status;
+-----------------+----------+--------------+------------------+
| File            | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------+----------+--------------+------------------+
| mysqllog.000002 | 20341461 |              |                  |
+-----------------+----------+--------------+------------------+

为什么从服务器不执行 SQL 语句?我读过有关使用 binlog_do_db 会破坏复制的文章。但这里的情况并非如此。

答案1

您认为中继日志和中继主日志中的位置为什么必须匹配?服务器之间的文件大小限制可能不同,您只需要确保master show statusslave show status主日志文件(在您的情况下是)和位置(是)匹配即可

相关内容