Jump to content

Recommended Posts

I have a MySQL question that deal with replications and I am hoping that someone where can help me as I am at my whits end with this problem.  Currently I have 2 databases for a site that are in different countries.  I have Master / Slave replication setup between the 2 databases and the replications is working great.  The database is very large so for backing it up for the time being I am doing a mysqldump and including the --master-data=1 option on the Slave box.

 

Due to the size of the database I currently do not have enough disk space to create a second copy of the DB (this will be corrected in about 2 weeks) on the slave server so Developers have been using the the "Slave" DB for development purposes.  What I am trying to do is every night before the backups run restore the previous nights backup and then let the MySQL BIN logs catch the slave up and then finally do a clean mysqldump of the DB.

 

What I am finding is that in my backups on the Slave server the line that starts out "CHANGE MASTER TO MASTER_LOG_FILE" is pointing to a BIN Log position on the slave server.  Thus if I let it replay those BIN logs I get both what was sent from the MASTER through the day plus all the changes that the Development team made.  My question is this...With running mysqldumps on the SLAVE server is there a way to get the SLAVES position in the MASTERS BIN logs and then when the file is restored reset replication back to that point?

 

Thank

 

whit3fir3

 

Link to comment
https://forums.phpfreaks.com/topic/210803-mysql-replicaton-question/
Share on other sites

The master-data flag is there so you can load the data onto a new slave that will connect to the server you did the dump from, it doesn't track the current slave's position.

 

You might try in your backup script dumping the output of "show slave status;" to the head of your dump.  You'd of course have to remove this section before restoring the dump, but it would give you the master log and position at the start of the dump.  You don't want to have master-data turned on for regular backups of a slave.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.