2013-05-05 3 views
4

dns 서버가 마스터 레코드를 가져오고 모든 레코드가 마스터에서 슬레이브로 복제되고 슬레이브가 해결에 사용되는 상황이 있습니다. mysql 서버를 업그레이드 한 후 복제가 중단되었다. mysql 서버가 중지되고 로그 파일의 이름과 로그 위치가 mysql이 복구 될 때까지 변경되었습니다. 이제 내가 로그 위치를 변경하고 파일 이름을 로그하면 복제가 시작되지만 많은 업데이트를 놓치고 싶지 않다는 것을 알고 있습니다. 마스터 업데이트를 잃지 않고 마스터 슬레이브 복제를 다시 시작하려면 어떻게해야합니까? 모든 단일 업데이트가 중요합니다. 다음은 슬레이브 상태에 대한 정보입니다.mysql 슬레이브 복제가 실패했습니다.

Slave_IO_Running: No 
Slave_SQL_Running: Yes 

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' 

감사

답변

5

당신은 좋은 놀랄 수 있지만 여기에 있습니다 간다 :

실행 SHOW SLAVE STATUS\G.

  • Relay_Master_Log_File (mysql-bin.003202)
  • Exec_Master_Log_Pos (577991837)

:

   Slave_IO_State: Waiting for master to send event 
       Master_Host: 10.64.68.253 
       Master_User: replusername 
       Master_Port: 3306 
       Connect_Retry: 60 
      Master_Log_File: mysql-bin.003202 
     Read_Master_Log_Pos: 577991837 
      Relay_Log_File: relay-bin.010449 
       Relay_Log_Pos: 306229695 
     Relay_Master_Log_File: mysql-bin.003202 
      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: 577991837 
      Relay_Log_Space: 306229695 
      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 

당신은 화면에서 다음을 선택합니다 : 예를 위해서 들어, 당신이 얻을 가정 해 봅시다 이유는 다음과 같습니다. Relay_Master_Log_FileExec_Master_Log_Pos은 만든 마스터의 binlog 항목을 나타냅니다. 그것은 슬레이브에게 성공적으로 실행되었습니다. 거기에서 간단하게 픽업.

당신은 단순히이 코드를 실행합니다 : Exec_Master_Log_Pos

STOP SLAVE; 
CHANGE MASTER TO 
MASTER_LOG_FILE='mysql-bin.003202', 
MASTER_LOG_POS=577991837; 
START SLAVE; 

그것을 시도 줄!

주의

Relay_Master_Log_File 더 이상 마스터에있는 경우, 당신은 어떤 손상 제어를 할 수 있습니다. 다음과 같이 이전에 언급 한 SHOW SLAVE STATUS\G을 감안할 때, 당신은 마스터에 다음 바이너리 로그에 건너 뛸 수있다 :

STOP SLAVE; 
CHANGE MASTER TO 
MASTER_LOG_FILE='mysql-bin.003203', 
MASTER_LOG_POS=4; 
START SLAVE; 

을 복제가 잡으면, 당신은 단지 숲에서하지 않습니다. Percona Toolkit을 다운로드하고 pt-table-checksumpt-table-sync을 실행하여 슬레이브에서 손실 된 데이터를 복구해야 할 수 있습니다.

복제가 진행되지 않으면 실사를 수행하고 슬레이브를 다시로드해야합니다.

복제본이 원래 제안 사항과 함께 작동하면이주의 사항을 수행하지 않아도됩니다.

5

주어진 대답이 저에게 효과적이지 않았습니다. 실제로 취해야하고 master_log_file로 설정해야하는 적절한 파일을 다른 위치에서 복사해야합니다. 당신이 나를 위해 일한 지시주기 :

Slave Server: stop slave; 


In Master Server: flush logs 


In Master Server: show master status; — take note of the master log file and master log position (on my end is 'peer-bin.000264' and pos=120) 

Slave Server : CHANGE MASTER TO MASTER_LOG_FILE=’peer-bin.000264′, MASTER_LOG_POS=120; 


Slave Server: start slave; 
+0

당신의 명시 적 이름을 추천 포스팅을 따라하는 경우를 '마스터 mysql을 - 빈'이 'STOP 노예 일치하지 않는 경우는이 오류가 발생합니다; CHANGE MASTER TO MASTER_LOG_FILE = 'mysql-bin.003202 ', MASTER_LOG_POS = 577991837; START SLAVE; – Conor

관련 문제