List:General Discussion« Previous MessageNext Message »
From:Shawn Green (MySQL) Date:August 15 2011 2:22pm
Subject:Re: hand replication
View as plain text  
On 8/15/2011 09:06,  wrote:
>>>>> 2011/08/10 08:16 +0200, Johan De Meersman>>>>
> Yes, the MySQL binary log can be read (and thus, re-executed) by the mysqlbinlog
> utility.
> <<<<<<<<
> Yes, but what is the best means of picking up the changes from the instance where
> there were changes to the instance that is a copy? Is it best to copy the log and that so
> use "msqlbinlog"? Or is it better so to use "msqlbinlog" that it makes SQL statements that
> I copy to the other instance?
> No TCP/IP here, only a flash drive.

If you are going to pretend to be the MySQL replication system, it 
wouldn't hurt you to understand the process before you start.  First, 
read the replication chapter in the manual. It will describe the theory 
behind replication.

Next, you need to realize that you will be replacing both the SLAVE IO 
thread and the SLAVE SQL thread with your process.

The SLAVE IO thread you replace when you get the statements the slave 
needs to replicate onto the flashdrive. You can do that two different ways:

1) extract the statements from the binary log.
2) get the master to sent you the statements just as if you were a slave.

mysqlbinlog will do either - (again, read the manual on how to use the 

Once you have collected the statements you need the slave to apply (and 
put them on your flash drive), now it's your turn to replay those 
statements on the slave. The easiest tool for that will probably be the 
mysql client (a command-line tool). This is where you become the SLAVE 
SQL thread.

Beyond that, all you really need to keep up with is the binary log 
position you replicated last (again, pretending to be the SLAVE IO thread).

Best of luck! what you are doing is definitely labor intensive.

Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN
hand replicationhsv8 Aug
  • Re: hand replicationJohan De Meersman10 Aug
    • Re: hand replicationhsv15 Aug
      • Re: hand replicationMySQL)15 Aug
        • Re: hand replicationhsv15 Aug