0

I have a setup of two databases, master - slave. Slave was stooped for about two weeks and old binlogs binlogs purged from master but copied on another fs before purging.

Slave can't catch up the master because index don't contain anymore the names of the purged binlogs.

I've already copied old binlogs to the correct place but now I need to edit the .index file on master.

Is there a tool that can be used to tell mysql too add binary logs back to index files (somethinf like unpurge :) or add binary log) or can index file be edited without shutting down mysql ?

Thanks a lot.

2 Answers 2

0

The bin log index file can be edited with the binlog file names without restarting the mysqld server.

Although after restoring the files back to the binlog location, you may want to make sure that the files you copied have same ownership and permissions for mysqld user to access those.

steps: 1:- determine the location where your bin logs are stored. you can get the location from "/etc/my.cnf" , which i believe you are already aware of. 2:- copy the backups to the location, which i believe you have already done. 3:- Edit the indexfile 4:- add a line above for each file. 5:- update the permissions and ownership -- chown mysql:mysql filename (assuming you are running with user mysql) 5:- show binary logs

Note you may want to keep the slave off while making changes and start slave once all files are showing on the mysql client.

0

I have never tried but I am quite positive about editing index file. You can add filenames to index without restarting.

That said you actually don't need to. You can copy over the files to slave and play the sql. Generate sql using mysqlbinlog utility.

1
  • I'm using mysqlbinlog right now but the problem is that master_exec sequence is not changing. I'm thinking to "apply" all missing binlogs and then reset slave and add again the master.
    – gig
    Commented Dec 4, 2015 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.