Rơle MySQL v5.1.61 bị hỏng khi máy đột ngột tắt. Tôi đã cố gắng sửa nó nhưng nó không hoạt động. 
- Làm thế nào để tôi sửa chữa nó? Tôi đã làm gì sai sao?
Theo như tôi đã đọc, các bản ghi chuyển tiếp MySQL bị hỏng rất dễ sửa:
change master to master_log_file='<Relay_Master_Log_File>',
                 master_log_pos=<Exec_Master_Log_Pos>;ở đâu Relay_Master_Log_Filevà Exec_Master_Log_Posđược liệt kê bởi:
mysql> show slave status;
Tuy nhiên, khi tôi làm change master status ..., tôi đã gặp một lỗi vi phạm khóa chính. Làm thế nào là có thể? Là quy trình trên không đúng, hay ví dụ như thiếu +1?
(Hiện tại, tôi chỉ cần nhập lại một mysqldump - dữ liệu chính từ chủ sang nô lệ và điều này đã giải quyết được vấn đề. Tuy nhiên, trong tương lai, việc đó có thể không phù hợp.)
Dưới đây là chi tiết về vấn đề cụ thể của tôi:
mysql> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: the-master-host
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000021
          Read_Master_Log_Pos: 33639968
               Relay_Log_File: mysql-relay-bin.000271
                Relay_Log_Pos: 2031587
        Relay_Master_Log_File: mysql-bin.000020
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: the_database
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1594
                   Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 66395191
              Relay_Log_Space: 36559177
              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: 0
                Last_IO_Error: 
               Last_SQL_Errno: 1594
               Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.Và đây là những gì tôi đã làm:
mysql> stop slave;
mysql> reset slave;
mysql> change master to master_host='the-master-host', master_user='replication', master_password='the-password', master_log_file='mysql-bin.000020', master_log_pos=66395191;
mysql> start slave;Và đây là những gì đã xảy ra, một lỗi PK:
131122 15:17:29 [Note] Slave I/O thread: connected to master 'replication@the-master-host:3306',replication started in log 'mysql-bin.000020' at position 66395191
131122 15:17:29 [ERROR] Slave SQL: Error 'Duplicate entry '71373' for key 'PRIMARY'' on query. Default database: 'the_database'. Query: 'insert into ...  values ...', Error_code: 1062
131122 15:17:29 [Warning] Slave: Data truncated for column 'date' at row 1 Error_code: 1265
131122 15:17:29 [Warning] Slave: Duplicate entry '71373' for key 'PRIMARY' Error_code: 1062Tôi nghĩ rằng tôi đã làm theo quy trình được đề xuất (xem các liên kết ngay bên dưới), vẫn có lỗi PK :-(? Http://bugs.mysql.com/orms.php?id=26361 , tìm kiếm "Giải pháp thay thế". Http: //mhbarr.wordpress.com/2013/07/26/mysql-slave-corrupted-relay-log/ /programming//a/14438408
SET GLOBAL sql_slave_skip_counter = 1; START SLAVE;và bỏ qua một sự kiện trên nô lệ, và hy vọng điều đó có ích - điều đó có hợp lý không? Nếu nó không hữu ích (nếu vẫn còn lỗi PK), tôi sẽ nhập lại một bãi chứa --master-data.