How to re-sync the Mysql DB if Master and slave have different database incase of Mysql replication?

前端 未结 14 995
小蘑菇
小蘑菇 2020-11-29 14:20

Mysql Server1 is running as MASTER.
Mysql Server2 is running as SLAVE.

Now DB replication is happeni

14条回答
  •  忘掉有多难
    2020-11-29 14:55

    We are using master-master replication technique of MySQL and if one MySQL server say 1 is removed from the network it reconnects itself after the connection are restored and all the records that were committed in the in the server 2 which was in the network are transferred to the server 1 which has lost the connection after restoration. Slave thread in the MySQL retries to connect to its master after every 60 sec by default. This property can be changed as MySQL ha a flag "master_connect_retry=5" where 5 is in sec. This means that we want a retry after every 5 sec.

    But you need to make sure that the server which lost the connection show not make any commit in the database as you get duplicate Key error Error code: 1062

提交回复
热议问题