mysql同步錯誤

來源:互聯網
上載者:User

標籤:mysql 同步出錯

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/58/41/wKioL1StALGifQ6TAAKMao9u7Os545.jpg" title="無標題.png" alt="wKioL1StALGifQ6TAAKMao9u7Os545.jpg" />

今天收到郵件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 Variable Name slave_skip_errors
Variable Scope Global
Dynamic Variable No
Permitted Values Type string
Default OFF
Valid Values OFF
[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 STATUS. Appendix 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同步錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.