View Single Post
Old 2005-04-04, 10:06 AM   #6
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
fam/rsync doesn't work with databases. Use Mysql Replication

Mysql 4.x is much easier to set up replication than 3.x used to be, and, Mysql 4.1 includes clustering which is the ultimate, but, isn't released as 'stable'.

devshed.org used to have a pretty good tutorial, but, I couldn't find it. Mysql's site isn't too bad with it.

With replication, you need to make sure you use atomic updates, although that's a pretty standard thing from a performance standpoint.

i.e.

update table set counter=counter+1 where domain_id=123;

rather than

select counter from table where domain_id=123;
php code to add 1 to $row['counter']
update table set counter=$row['counter'] where domain_id=123;

You'd be surprised how much code I run into that doesn't use atomic updates and they wonder why their stats are screwy.

other than that, once it is set, it is fire and forget. You can even shut down one machine or the other, and replication will spool things until the other server comes back.
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote