码迷,mamicode.com
首页 > 数据库 > 详细

mysql同步错误

时间:2015-01-07 19:05:56      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:mysql 同步出错

技术分享

今天收到邮件mysql从库同步出错了,后来跟开发沟通了一下说是,测试的时候向从库里插入过数据,后来删除了,以为不会影响主库,然后这个程序再向主库插入数据的时候报这个错了,

网上找了一下解决方法:

  

修改mysql配置文件 /etc/my.cnf 在 [mysqld]下加一行 slave_skip_errors = 1062 ,保存.重启mysql. mysql slave可以正常同步了.

这样对于数据的完整性没有保障


见:Replication Slave Options and Variables

 --slave-skip-errors=[err_code1,err_code2,...|all]

Command-Line Format--slave-skip-errors=name
System VariableNameslave_skip_errors
Variable ScopeGlobal
Dynamic VariableNo
Permitted ValuesTypestring
DefaultOFF
Valid ValuesOFF
[list of error codes]
all

Normally, replication stops when an error occurs on the slave. This gives you the opportunity to resolve the inconsistency in the data manually. This option tells the slave SQL thread to continue replication when a statement returns any of the errors listed in the option value.

Do not use this option unless you fully understand why you are getting errors. If there are no bugs in your replication setup and client programs, and no bugs in MySQL itself, an error that stops replication should never occur. Indiscriminate use of this option results in slaves becoming hopelessly out of synchrony with the master, with you having no idea why this has occurred.

For error codes, you should use the numbers provided by the error message in your slave error log and in the output of SHOW SLAVE STATUSAppendix B, Errors, Error Codes, and Common Problems, lists server error codes.

You can also (but should not) use the very nonrecommended value of all to cause the slave to ignore all error messages and keeps going regardless of what happens. Needless to say, if you use all, there are no guarantees regarding the integrity of your data. Please do not complain (or file bug reports) in this case if the slave‘s data is not anywhere close to what it is on the master. You have been warned.

Examples:

--slave-skip-errors=1062,1053
--slave-skip-errors=all


本文出自 “石头记” 博客,请务必保留此出处http://dodowolf.blog.51cto.com/793581/1600327

mysql同步错误

标签:mysql 同步出错

原文地址:http://dodowolf.blog.51cto.com/793581/1600327

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!