您的位置
主页 > 网站技术 > 数据库 > » 正文

MySQL中主从复制重复键问题修复方法(3)

来源: 锦尚中国 点击:

slave端errlog如下: 070208 16:07:59[ERROR] Slave: Error 'Duplicate entry '1' for key 1' on query. Default database: 'c2cdb'. Query: 'insert into tmp_te st_0208(name) values('a'),('b'),('c')', Error_code: 1062

070208 16:07:59 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE  START". We stopped at log 'db_auction1-bin.000203' position 14215101

070208 16:09:59 [Note] Slave SQL thread initialized, starting replication in log 'db_auction1-bin.000203' at position 14215101, rela y log './db_auction1_b-relay-bin.000457' position: 200682931

 

master羰binlog中相应的记录如下:

# at 14215101 #070208 16:08:00 server id 1  log_pos 14215101  Intvar SET INSERT_ID=1; # at 14215129 #070208 16:08:00 server id 1  log_pos 14215129  Query   thread_id=2744782       exec_time=0     error_code=0 SET TIMESTAMP=1170922080; insert into tmp_test_0208(name) values('a'),('b'),('c');

总结:使用SET GLOBAL SQL_SLAVE_SKIP_COUNTER 命令跳过失败的SQL




首页  - 关于站长圈  - 广告服务  - 联系我们  - 关于站长圈  - 网站地图  - 版权声明