Mysql master-slave replication errors and Solutions

Source: Internet
Author: User


Errors in mysql master-slave replication and solutions errors in slave logs code 1: [error] ERROR reading packet from server: Client requested master to start replication from impossible position; the last event was read from 'mysql-bin.000016' at 455562731, the last byte read was read from 'mysql-bin.000016' at 4. (server_errno = 1236) 120725 23:19:17 [ERROR] Slave I/O: Got fatal error 1236 from master when reading data from binary log: 'client requested master to start replication from impossible position; the last event was read from 'mysql-bin.000016 'at 100', Error_code: 455562
Solution: www.2cto.com first checks whether the log file on the master server has this line, the command used is mysqlbinlog/YOURPATH/'mysql-bin.42416>/test to find the row with 455562 or a line close 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 = '2017. 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 the number of rows in 'mysql-bin.20.16 ls-la mysql-bin.000016 if the number of rows in the statistics 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 = '2017. 168.192.45 ', MASTER_USER = 'backup', MASTER_PASSWORD = 'weiphone ', MASTER_LOG_FILE = 'mysql-bin.000017', MASTER_LOG_POS = 4; start slave; www.2cto.com
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 when it 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. Knowing the principle, the operation to be done is very easy to stop slave; set gloable SQL _slave_skip_counter = n; // n you want to skip the number of incorrect statements to start slave. If you do not want to encounter this 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 by leezqang

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.