slave-skip-errors

kakaxi9521發表於2021-07-13

--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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章