MySQL Replication Slave 忽略所有錯誤訊息(slave-skip-errors)

MySQL Replication Slave 忽略所有錯誤訊息(slave-skip-errors)

最近設定MySQL Replication同步更新,發現了一些問題,總結一下。
最常導致Slave_SQL_Running = no 的情況:
1.Master主機資料與Slave資料不同
2.Slave資料新增了,但Master並無此資料,導致auto id 重複。
3.Master新資料與Slave舊資料重複,而TB本身欄位設定為唯一,所以出現SQL錯誤。
MySQL 在 Replication 的 Slave 在正常情況下都是運作良好的, 但是在 Master 有錯誤/硬碟爆滿 或其它意外狀況下,

就會造成 Slave 會有些錯誤發生, 例如: MySQL Replication 出現 Duplicate Key.

以上最佳解的辦法就是直接忽略錯誤,繼續下個同步。
解決方法:
修改 slave_skip_erros 值
要改變 slave_skip_errors 的方法就只有在 MySQL 啟動時加:
–slave_skip_errors=all
或者於 /etc/my.cnf 加入:
slave-skip-errors=all # 於 [mysqld] 下面加入此行
再 restart mysql 即可
打完收工。
================================================================
Set MySQL Replication recently updated simultaneously, found some problems, to sum up.
The most common cause Slave_SQL_Running = no situation:
1.Master host of different data and Slave Data
2.Slave new information, but this information is no Master, leading auto id repeated.
3.Master Slave old data with new data duplication, and TB own field to be unique, so there are SQL errors.

MySQL Slave In Replication under normal circumstances are working well, but there is an error in the Master / HDD full or under other unexpected situations,
Will cause Slave will be some errors, such as: MySQL Replication appear Duplicate Key.

The above approach is the best solution simply ignore the error and continue to the next synchronization.
Solution:
Modify slave_skip_erros value

To change slave_skip_errors method only when MySQL starts plus:
– slave_skip_errors = all
Or in / etc / my.cnf added:
slave-skip-errors = all # in the [mysqld] add this line below
You can then restart mysql
Kick knock.

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *