Main operation:
- 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:
- 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
- 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