根据mysqlbin恢复丛库数据

1、查看错误日志,找出异常点

cat /db/mysql/mysql.log

140814 11:01:52 [ERROR] /usr/local/mysql/libexec/mysqld: Sort aborted
150121 11:30:38 [ERROR] /usr/local/mysql/libexec/mysqld: Sort aborted
150625 17:09:03 [ERROR] Slave SQL: Error 'Table 'IMDB.NEWSINGERWITHDRAWRECORD' doesn't exist' on query. Default database: 'IMDB'. Qu
ery: 'insert into NEWSINGERWITHDRAWRECORD select SERIALNUM,2,USERID, UNIX_TIMESTAMP(NOW()),CHANNELID,CASH,NAME,IDENTITYCARD,PROVINCE
,CITY, REGION,BANKBRANCH,BANKTYPE,BANKCARD,CONSUMEGOLD,REMAINGOLD,TRANFERSTATE, COMPLAINSTATE,COMPLAINREASON,COMPLAINTIME,GMNAME,GMI
D,OPTIME,RECORD, REPLY,PHONE,SINGERLEVEL,0 FROM SINGERWITHDRAWRECORD WHERE TIME>1433439938 AND WITHDRAWTYPE=0 GROUP BY USERID', Erro
r_code: 1146
150625 17:09:03 [Warning] Slave: Table 'IMDB.NEWSINGERWITHDRAWRECORD' doesn't exist Error_code: 1146
150625 17:09:03 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE
 START". We stopped at log 'mysql-bin.000966' position 717149534
150625 18:13:00 [Note] Slave I/O thread killed while reading event
150625 18:13:00 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000966', position818000316
150625 18:15:38 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000966' at position 820812134, relay log
 './IM-SJ01-DBServer04-relay-bin.000001' position: 4
150625 18:15:38 [Note] Slave I/O thread: connected to master 'repl@192.168.1.102:3306',replication started in log 'mysql-bin.000966'
 at position 820812134

2、导出没有同步的的sql语句

/usr/local/mysql/bin/mysqlbinlog --start-position=717149534 --stop-position=818000316 mysql-bin.000966 > export.sql

注:mysqlbinlog系统的继续可能会报错,请用mysql相同路径下的mysqlbinlog 

3、把export.sql拷贝到丛库

4、执行

mysql -uroot CHANNELDB < export.sql --force

注:--force可以强行忽略错误继续执行











本文转自 chengxuyonghu 51CTO博客,原文链接:http://blog.51cto.com/6226001001/1669834,如需转载请自行联系原作者
上一篇:Radware:安全信息的传送可以加速网络攻击的防御


下一篇:利用IPSec使用策略和规则提升网络安全性