Forums / General / File storage synchronization

File storage synchronization

Author Message

Gene Surov

Wednesday 14 October 2009 1:18:42 am

Hi,

my problem is the following: we have 2 servers: production server with Ubuntu 8.10 and development server - virtual machine with similar configuration.

I've created a simple script which synchronizes the DB (you can find it at the end of my post).

My current problem is to synchronize the uploaded files storage. I've found some mentions of cluster mode in ez publish which puts all the files (storage and cache), but I can't switch my production into this mode. Another possibility is to set up rsync, but it requires some efforts and this approach is not flexible enough. Had anyone had the same problem? Any suggestions?

!/bin/sh

date=`date +%Y%m%d%H%M%S`
filename=../sql/$date."bz2"

ssh sysuser@10.10.41.74 \
"mysqldump -udbuser -pdbpass -hproduction_db_server db_name | bzip2 -cz" \
> $filename

cd ../sql
bunzip2 $filename
mv $date db.sql

mysql -udev_db_user -pdev_db_pass dev_db < db.sql

Gaetano Giunta

Wednesday 14 October 2009 2:42:26 am

Since you already have a script for moving over the db, why not add in there 2 lines to copy over the zipped storage folder, too?

Other notes:
- add a call to ezcache.php to clean all caches after reimporting db+storage
- you might also add a call to eztc to recompile all templates (cache warmup)
- why not do a dump of the updated db (and associated storage) before overwriting it? just in case...

Of course if the copy is from prod to dev and not the other way round, the above steps can be done manually on the dev server by the developer itself...

Principal Consultant International Business
Member of the Community Project Board

Rose McMarry

Tuesday 27 October 2009 2:47:53 pm

I use a program to file synchronization, which is called File Sync. [URL="http://www.fileutilityblog.com/archives/188"]File Sync: why you need it?[/URL] May be because of its efficiency. That is why I use this program and haven't any problems. Did you use it?