2015-03-03 13 views
7

tôi có 2 MySql với một bậc thầy/cấu hình nô lệ và sự sao chép nào bị lỗi. Master MySql bị hỏng và một thanh ghi mới trong mysql-bin.index đã được tạo. Tôi đã xóa sổ đăng ký mới này vì tệp này không tồn tại trong hệ thống tệp. Sau đó, MySql Master khởi động lại thành công.Mysql lỗi 1236 từ bậc thầy khi đọc dữ liệu từ nhị phân log

Bây giờ, tôi có lỗi tiếp theo trong nô lệ:

mysql> show slave status \G 
*************************** 1. row *************************** 
      Slave_IO_State: 
       Master_Host: 10.64.253.99 
       Master_User: replication 
       Master_Port: 3306 
      Connect_Retry: 60 
      Master_Log_File: mysql-bin.001050 
     Read_Master_Log_Pos: 54868051 
      Relay_Log_File: mysqld-relay-bin.000001 
      Relay_Log_Pos: 4 
    Relay_Master_Log_File: mysql-bin.001050 
     Slave_IO_Running: No 
     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: 54868051 
      Relay_Log_Space: 107 
      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: NULL 
Master_SSL_Verify_Server_Cert: No 
      Last_IO_Errno: 1236 
      Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file' 
      Last_SQL_Errno: 0 
      Last_SQL_Error: 
Replicate_Ignore_Server_Ids: 
     Master_Server_Id: 1 

Nếu tôi thực hiện "show tình trạng tổng thể" để xem các log file mysql bin và vị trí:

mysql> show master status \G 
*************************** 1. row *************************** 
      File: mysql-bin.001050 
     Position: 55586895 
    Binlog_Do_DB: aaa 
Binlog_Ignore_DB: xxx,yyy,zzz,mysql 

Sau đó, Tôi đặt cấu hình mới cho nô lệ:

STOP SLAVE; 
CHANGE MASTER TO 
    MASTER_HOST='10.64.253.99', 
    MASTER_USER='slaveUser', 
    MASTER_PASSWORD='12345', 
    MASTER_LOG_FILE='mysql-bin.001050', 
    MASTER_LOG_POS=55586895; 
START SLAVE; 

Và nếu tôi kiểm tra lại trạng thái nô lệ, tôi có cùng lỗi:

mysql> show slave status \G 
*************************** 1. row *************************** 
      Slave_IO_State: 
       Master_Host: 10.64.253.99 
       Master_User: replication 
       Master_Port: 3306 
      Connect_Retry: 60 
      Master_Log_File: mysql-bin.001050 
     Read_Master_Log_Pos: 55586895 
      Relay_Log_File: mysqld-relay-bin.000001 
      Relay_Log_Pos: 4 
    Relay_Master_Log_File: mysql-bin.001050 
     Slave_IO_Running: No 
     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: 55586895 
      Relay_Log_Space: 107 
      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: NULL 
Master_SSL_Verify_Server_Cert: No 
      Last_IO_Errno: 1236 
      Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file' 
      Last_SQL_Errno: 0 
      Last_SQL_Error: 
Replicate_Ignore_Server_Ids: 
     Master_Server_Id: 1 

Tôi đã kiểm tra trong MySql Master rằng mysql-bin.001050 tồn tại và không trống.

Đây là một môi trường sản xuất dữ liệu sau đó mới được chèn vào mỗi phút. Giá trị vị trí có thể thay đổi theo phút hoặc giây. Tôi không biết đây có phải là vấn đề không.

Biến max_allowed_packet có cùng giá trị trong hai MySql (16M).

Tại sao không thể nô lệ tìm các log file nhị phân?

Trả lời

13

Bạn có thể thử này:

  1. Slave: stop slave;
  2. Master: flush logs
  3. Master: show master status; — take note of the master log file and master log position

  4. Slave: CHANGE MASTER TO MASTER_LOG_FILE='log-bin.00000X', MASTER_LOG_POS=106;

  5. Slave: start slave;
Các vấn đề liên quan