MySQL GTID 主從修復

解決從服務器主服務器不一樣步

  1. 主庫 備份相應的庫
# mysqldump -uroot -p xxx > xxx.sql
  1. 從庫 中止掉slave進城並恢復最新的備份
mysql> stop slave;
mysql> source xxx.sql;

錯誤:mysql

Slave_IO_Running:No
Slave_SQL_Running:Yes
Last_IO_Error:Got fatal error1236from master when reading data from binary log:'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.'

解決:sql

  1. 主庫 注意 GTID_EXECUTED
master>show global variables like 'GTID_EXECUTED';
+---------------+-------------------------------------------+
|Variable_name|Value|
+---------------+-------------------------------------------+
|gtid_executed|9a511b7b-7059-11e2-9a24-08002762b8af:1-14|
+---------------+-------------------------------------------+
  1. 從庫 注意 GTID_PURGED
slave1>reset master;
slave1>show global variables like 'GTID_EXECUTED';
+---------------+-------+
|Variable_name|Value|
+---------------+-------+
|gtid_executed||
+---------------+-------+
slave1>set global GTID_PURGED="9a511b7b-7059-11e2-9a24-08002762b8af:1-14";
slave1>start slave;
slave1>show slave status\G
[...]
Slave_IO_Running:Yes
Slave_SQL_Running:Yes
[...]
相關文章
相關標籤/搜索