MySQL Forums
Forum List  »  Replication

Re: Start slave fails
Posted by: Rick James
Date: March 27, 2010 10:04AM

The steps you outlined in your first posting are missing the necessary locks (or shutdown). Without these, you are catching one table in one state, another table with newer records.

If you don't have a slave to clone, all the "off the shelf" methods of creating a slave involve stopping or locking the Master long enough to take a full, "consistent", dump.

With code, you could write a complicated program to read from the Master and write to the Slave. This would copy most of the data, then copy some more, finally lock the master long enough to locate and copy the last few records and capture the binlog position. The program would have to understand how all the tables are structured so that it could find any changes since the last pass. The tables you have may not be structured to allow such. Some tricks for such:

* AUTO_INCREMENT, and you only INSERT, never DELETE or UPDATE.
* TIMESTAMP, and you never explicitly set that field, and the field is indexed; then you could find all new/modified rows using it. Oh, and DELETEs are a no-no.
* Otherwise, you are stuck with locking _all_ tables long enough to dump the entire table.

There are for-sale dump packages, but they tend to work well for InnoDB, but resort to brute force (as above) for MyISAM tables. (Or they ignore consistency for MyISAM tables.)

Options: ReplyQuote


Subject
Views
Written By
Posted
3537
March 23, 2010 06:51PM
1508
March 24, 2010 09:10AM
1684
March 24, 2010 05:40PM
1370
March 26, 2010 11:26PM
1478
March 27, 2010 05:19AM
Re: Start slave fails
1366
March 27, 2010 10:04AM
1607
March 27, 2010 05:00PM
1442
March 27, 2010 09:35PM
1346
March 28, 2010 05:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.