Error Code 1 in the slave log:
- [ERROR] Error reading packetFromServer: Client requested masterToStart replicationFromImpossible position;LastEvent wasRead From 'Mysql-bin.20.16' At455562731,LastByteReadWasRead From 'Mysql-bin.20.16' At4. (server_errno = 1236)
- 120725 23:19:17 [ERROR] Slave I/O: Got fatal error 1236FromMasterWhenReading dataFrom BinaryLog:'Client requested master to start replication from impossible position; the last event was read from'Mysql-bin.000016'At 100'Error_code: 1236
Solution:
First, check whether the corresponding log file in the master server has this line. The command used is
Mysqlbinlog/YOURPATH/'Mysql-bin.000016>/test
Check whether there are rows corresponding to 455562 or rows that are very similar to this number, and then use the chang master to command to skip this line. The command format is as follows:
- stop slave;
- CHANGE MASTER TO MASTER_HOST='192.168.192.45',MASTER_USER='XXXX',MASTER_PASSWORD='XXXX',MASTER_LOG_FILE='mysql-bin.000016',MASTER_LOG_POS=455678;
- start slave;
If you cannot find 455562 or a line that is very close to this number, you can use the following command to view'Mysql-bin.000016 rows
- ls -la mysql-bin.000016
If the number of rows is much less than 455562, you can skip this log and copy it from the next log. The command is as follows:
- stop slave;
- CHANGE MASTER TO MASTER_HOST='192.168.192.45',MASTER_USER='backup',MASTER_PASSWORD='weiphone',MASTER_LOG_FILE='mysql-bin.000017',MASTER_LOG_POS=4;
- start slave;
Error Type Code 2:
Mysql slave Error_code: 1062 1054
If such code appears in the log, it may be the wrong select or update operation. The master skips these operations but is recorded in the binary log, slave will perform the same action based on the statements in the binary, and an error will be reported. It is easy to understand the principle and perform the operation.
- Stop slave;
- Set gloableSQL _slave_skip_counter= N; // n the number of statements you want to skip
- Start slave;
If you do not want to encounter such an error, you can write it to the slave configuration file in the following format:
- Slave_skip_errors=1062
- Slave_skip_errors=All// Skip all types of error codes