[Tfug] MySql and rsync

Adrian choprboy at dakotacom.net
Tue Apr 17 18:43:08 MST 2007


On Tuesday 17 April 2007 14:19, Terence Rudkin wrote:
> Any MySQL experts out there?
> My company has a program using rsync to load files into a mysql database.
> It appears to mostly work, but some files are not getting inserted.   The
> process is loading about 5 records a second / 16k hour, not sure how big  a
> record is.
> Anyone with expertise is using rsync with mysql?   Or even Mysql tuning
> 


In general... that is a very bad idea unless you can garrantee that both the 
source and destination databases are completely stopped before doing the 
rsync. A running MySQL will not necessarily write all data to the file (index 
and data file) when it is running, it will cache some data to consolidate 
writes to disk.

A better option would be to use the built-in master/slave architecture in 
MySQL. Set your source as the master and slave the destination. MySQL will 
periodically update those records that have changed (not rsync'ing the entire 
table) from the master to the slave. I believe you can set the update 
period/number of record changes per slave update period.

Adrian




More information about the tfug mailing list