Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Adding slave to existing master-master config throws foreign key constraint failed error

$
0
0

We have two MySQL servers running in master - master configuration.

Now we have to add a slave to the existing configuration, but upon adding the third database server and starting slave on it, it throws:

Cannot add or update a child row. foreign key constraint fails

We have tried taking a mysqldump from the master with --master-data and restored it. After that, we started the slave on the slave DB. But even then, it says the same error. We have also tried XtraBackup. But that also throws the same error. Are we missing something?

mysqldump command:

mysqldump --master-data -uroot -p dbname > dbname.sql

We have also tried it this way: percona xtrabackup

In both cases, upon getting the foreign key error, we tried to dump and restore individual tables referenced by the foreign keys manually from the master to the slave. Upon doing this, the replication starts and seems to work normally with 0 seconds behind master for a few minutes, after which another foreign key error shows up, stopping the replication.

  • auto_increment_increment is set to 2 in both masters.
  • auto_increment_offset is set to 1 in Master 1 and 2 in Master 2.
  • We have mostly innoDB tables and some MyISAM tables.
  • MySQL version 5.5.30.

There is a follow up question: After adding a slave to Master - Master configuration, slave syncs from only one master


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>