欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MYSQL主從庫(kù)不同步故障一例解決方法

 更新時(shí)間:2010年06月09日 18:25:46   作者:  
第一次做完主從庫(kù)同步后正常,但工作過程中發(fā)現(xiàn)有一個(gè)庫(kù)的數(shù)據(jù)庫(kù)沒有同步起來,在另外一個(gè)mysql(3307)中
于是:

1、在主庫(kù)中創(chuàng)建一個(gè)臨時(shí)庫(kù),將需要導(dǎo)入的表文件復(fù)制過來

2、執(zhí)行

create database tmpdb;

create table tmptable;

cp mysql_date_file master_data_file //shell command 復(fù)制數(shù)據(jù)表文件到master data_dir下

insert into master.tmptable select * from tmpdb.tmptable;

執(zhí)行完后,主庫(kù)中數(shù)據(jù)導(dǎo)入正常

再看slave status

show slave status;

發(fā)現(xiàn)錯(cuò)誤:not found tmpdb.tmptable (大致意思是這個(gè),原來的錯(cuò)誤信息沒有記錄下來)

匆忙中,看show master status 中Master_Log_Pos 標(biāo)記為$Master_Log_Pos

然后在slave 上 CHANGE MASTER TO MASTER_LOG_POS=$Master_Log_Pos

然后再看show master status,發(fā)現(xiàn)有1162錯(cuò)誤

到現(xiàn)在發(fā)現(xiàn)兩邊的數(shù)據(jù)不能同步了

。。。。。。

冥思苦想,不會(huì)重新做一遍主從庫(kù)吧?

mysqlbinlog 我突然想到了它

于是mysqlbinlog --start-position=190000000 --stop-position=200000000 xxx.binlog|grep tmptable

找到了在slave上執(zhí)行錯(cuò)誤的SQL

mysqlbinlog --start-position=190000000 --stop-position=200000000 xxx.binlog|grep tmptable > /tmp/tmpbinlog

vi /tmp/tmpbinlog (find tmptable)

找到錯(cuò)誤SQL的下一個(gè)# at (一串?dāng)?shù)字)標(biāo)記為$NEXT_POS

在slave 上 CHANGE MASTER TO MASTER_LOG_POS=$NEXT_POS

show slave status 顯示:

Slave_IO_Running: Yes
Slave_SQL_Running: Yes

哈哈,完成同步。

如果中間碰到1062錯(cuò)誤 在slave配置文件中設(shè)定slave-skip-errors=1062,重啟slave

相關(guān)文章

最新評(píng)論