MySQL master-slave replication problem of master-slave both ends Binlog log out of sync solution

Source: Internet
Author: User

Main operation:

    1. Enter the main database to view the status:

Mysql> Show Master STATUSG;

1. Row ***************************

file:mysql-bin.000001

position:604

binlog_do_db:

binlog_ignore_db:

1 row in Set (0.01 sec)

From the operation:

    1. Enter the database to view the status from:

Mysql> show Slave statusg;

1. Row ***************************

Slave_io_state:

master_host:192.168.1.187

master_user:slave001

master_port:3306

Connect_retry:60

master_log_file:mysql-bin.000001

read_master_log_pos:800

relay_log_file:mysqld-relay-bin.000001

Relay_log_pos:4

relay_master_log_file:mysql-bin.000001

Slave_io_running:no

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:800

relay_log_space:106

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:1236

Last_io_error:got fatal Error 1236 from master when reading data from binary log: ' Client requested Master to start repli Cation from impossible position '

last_sql_errno:0

Last_sql_error:

1 row in Set (0.00 sec)

Will find that the state is not the same as the primary state (mainly observed master_log_file and Read_master_log_pos), that is Binlog log is out of sync

    1. Now you need to synchronize the master and slave data before synchronizing the Binlog log to resolve the problem

(1). Stop updating the primary database, view Binlog (file and Positon), package and put it on the recovery from server

(2). Stop from the slave, modify the Binlog (depending on the view master's file and position), then start the slave, and finally release the main lock

Detailed instructions have been made in MySQL master-slave synchronization configuration to see

MySQL master-slave replication Problem master-slave binlog log out of sync solution

Related Article

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.