官方说明:
-
--slave-skip-errors=[
err_code1
,err_code2
,...|all](MySQL Cluster NDB 7.0.33 and later; MySQL Cluster NDB 7.1.22 and later:)
--slave-skip-errors=[
err_code1
,err_code2
,...|all|ddl_exist_errors]Command-Line Format --slave-skip-errors=name
Option-File Format slave-skip-errors
System Variable Name slave_skip_errors
Variable Scope Global Dynamic Variable No Permitted Values (>= 5.1.61-ndb-7.0.33,5.1.61-ndb-7.1.22) Type string
Default OFF
Valid Values [list of error codes]
all
ddl_exist_errors
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.
NotePrior to MySQL 5.1.35, this option had no effect with row-based logging. (Bug #39393)
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 STATUS
. Appendix C, 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 useall
, 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.For MySQL Cluster Replication in MySQL Cluster NDB 7.0 beginning with version 7.0.33 and MySQL Cluster NDB 7.1 beginning with version 7.1.22, an additional shorthand value
ddl_exist_errors
is supported for use with the enhanced failover mechanism which is implemented in that and later version of MySQL Cluster NDB 7.2. This value is equivalent to the error code list1007,1008,1050,1051,1054,1060,1061,1068,1094,1146
. This value is not supported by the mysqld binary included with the MySQL Server 5.1 distribution. (Bug #11762277, Bug #54854) For more information, see Section 17.6.8, “Implementing Failover with MySQL Cluster Replication”.Examples:
--slave-skip-errors=1062,1053
--slave-skip-errors=all
--slave-skip-errors=ddl_exist_errors
System variables used on replication slaves. The following list describes system variables for controlling replication slave servers. They can be set at server startup and some of them can be changed at runtime usingSET
. Server options used with replication slaves are listed earlier in this section.
如果从库主要用作主库的备份,那么就不应该使用这个启动参数。设置不当,很可能造成主从数据库的数据不同步。但是,如果从数据库仅仅是为了分担主数据库的查询压力,且对数据的完整性要求不是很严格,那么这个选项的确可以减轻数据库管理员维护从数据看的工作量。