ITPub博客

首页 > 数据库 > MySQL > slave-skip-errors

slave-skip-errors

翻译 MySQL 作者:kakaxi9521 时间:2021-07-13 14:19:19 0 删除 编辑

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

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

正常情况下,当有error时复制会中断,给机会手动解决数据不一致的问题。  slave-skip-errors 会使sql 线程忽略这些error 继续复制。


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 replicas becoming hopelessly out of synchrony with the source, with you having no idea why this has occurred.

不要随便使用此参数,除非你完全了解为什么会报错。 在复制配置,客户端没有错误的情况下,Mysql 本身没有bug的情况下,复制是不会中断的。 随意的使用此参数会导致主从不一致。


For error codes, you should use the numbers provided by the error message in the replica's error log

and in the output of SHOW SLAVE STATUS. Appendix B, Error Messages and Common Problems, lists server error codes.

对于错误codes, 可以通过show slave status的输出信息进行查看。


The shorthand value ddl_exist_errors is equivalent to the error code list

1007,1008,1050,1051,1054,1060,1061,1068,1094,1146.

相面列出了较为常见的ddl_exist_errors ,  1007,1008,1050,1051,1054,1060,1061,1068,1094,1146.


You can also (but should not) use the very nonrecommended value of all to cause the replica 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 replica's data is not anywhere close to what it is on the source. You have been warned.


Examples:

--slave-skip-errors=1062,1053

--slave-skip-errors=all

--slave-skip-errors=ddl_exist_errors


参考文档:

https://dev.mysql.com/doc/refman/5.7/en/replication-options-replica.html#option_mysqld_slave-skip-errors


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21374452/viewspace-2781039/,如需转载,请注明出处,否则将追究法律责任。

下一篇: sql_slave_skip_counter
请登录后发表评论 登录
全部评论

注册时间:2009-04-13

  • 博文量
    119
  • 访问量
    120756