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' position717149534
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
mysqlbinlog --start-datetime='2013-09-10 00:00:00' --stop-datetime='2013-09-10 01:01:01' -d 库名 二进制文件
3、把export.sql拷贝到丛库
4、执行
mysql -uroot CHANNELDB < export.sql --force
注:--force可以强行忽略错误继续执行