Failed to replicate mysql slave server

I have a situation where the dns server receives records for its master, and all records are replicated from the master to the slave, and slave is used for permission. Replication completed after mysql server upgrade. The mysql server stopped and the log file name and log position changed until mysql was restored. Now I know that if I changed the position of the log and the name of the log file, replication will start, but I will miss many updates and that I do not want. What do I need to do to restart master slave replication without losing any updates on the host computer. Each update is important. Here is some information from slave status.

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' 

thanks

+4
source share
2 answers

You may have a pleasant surprise, but here goes:

Launch SHOW SLAVE STATUS\G For example, let's say you get the following:

  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 

On the display, select the following:

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

Here's why: Relay_Master_Log_File and Exec_Master_Log_Pos present a binlog entry from the master, which made it a slave and was successfully executed. Just from there from there.

You would simply run this code: Exec_Master_Log_Pos

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

Give it a try !!!

CAVEAT

If Relay_Master_Log_File no longer exists on the Wizard, you may have to damage it a bit. Given the SHOW SLAVE STATUS\G mentioned above, you may need to go to the next binary log on Master as follows:

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

If replication catches up with you, you are not out of the woods. You may need to download the Percona Toolkit and run pt-table-checksum and pt -table-sync to recover the lost data in the Slave.

If replication does not go off the ground, you will have to perform due diligence and reboot Slave.

I hope you don’t have to do anything in this caution if replication works with the original sentence.

+5
source

This answer did not help me. Actually, the file that needs to be taken and installed as the master_log_file file must be copied from another place. Providing you with instructions that worked for me:

 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; 
+5
source

Source: https://habr.com/ru/post/1479277/


All Articles