資料庫多源複製同步錯誤修複

來源:互聯網
上載者:User

標籤:stopped   user   自己   start   err   報錯   sla   href   原因   

報錯是這樣的:

發現有一個資料庫報錯了。報錯如下。

Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction ‘ANONYMOUS‘ at master log mysql-bin.000029, end_log_pos 6389312. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

解決方案:
進入從伺服器,mysql

1.查看從庫狀態
mysql> show slave status;

2.按照從庫的提示尋找原因。
select * from performance_schema.replication_applier_status_by_worker\G

是說主庫某個表刪除時,從庫卻找不到刪除的記錄。

網上對類似問題有修複的方法。
http://www.bcty365.com/content-35-5816-1.html

因一下沒看明白。(後續實踐,再補充)

3.先停止主從同步。

mysql> stop slave;

4.用navicate工具把資料庫同步。
navicate的功能表列,工具->資料同步。
先 結構同步,再 資料同步。

然後,同步完後,到主庫。用命令。
mysql>SHOW MASTER STATUS;

因為我這裡做的是多源複製。所以把兩個資料庫同步後,先後記錄下來。
得到:
‘mysql-bin.000029‘, ‘20698487‘,
‘mysql-bin.000042‘, ‘84950954‘,

5.清空原來的同步設定
mysql>reset slave all;

6.再設定同步。
下面的ip地址,username,password,是舉例的。大家按自己的來。

change master to master_host=‘192.168.0.1‘,master_user=‘username1‘,master_port=3306,master_password=‘password1‘,master_log_file=‘mysql-bin.000029‘,master_log_pos=20698487 for channel ‘databasename1‘;

change master to
master_host=‘192.168.0.2‘,master_user=‘username2‘,master_port=3306,master_password=‘password2‘,master_log_file=‘mysql-bin.000042‘,master_log_pos=84950954 for channel ‘databasename2‘;

7.啟動同步
mysql> start slave;

8.查看同步狀態
mysql> show slave status;

同步恢複正常了。

資料庫多源複製同步錯誤修複

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.