mysql主從斷掉後,恢復

主庫:10.0.2.75;從庫:10.0.2.230;

mysql> show slave status\G;

mysql> flush tables with read lock\G

mysql> show master status\G

mysql> change master to master_host='10.0.2.230', master_user='root', master_password='123456', master_log_file='mysql-bin.000005', master_log_pos=625;

###mater_log_file和master_log_pos的值是在從庫上執行show master status的結果

mysql> start slave;

出現報錯;處理;

mysql> reset slave;

重新配置;

mysql> change master to master_host='10.0.2.230', master_user='root', master_password='123456', master_log_file='mysql-bin.000005', master_log_pos=625;

mysql> start slave;

mysql> show slave status\G;

主庫成功;開始配置從庫;

mysql> flush tables with read lock\G

mysql> show master status\G

mysql> change master to master_host='10.0.2.75', master_user='root', master_password='123456', master_log_file='mysql-bin.000008', master_log_pos=639208;

###mater_log_file和master_log_pos的值是在主庫上執行show master status的結果

mysql>  start slave;

mysql> reset slave;

mysql> change master to master_host='10.0.2.75', master_user='root', master_password='123456', master_log_file='mysql-bin.000008', master_log_pos=639208;

mysql>  start slave;

mysql> show slave status\G

mysql> UNLOCK TABLES;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章