[support] Drupal files synchronization

Jamie Holly hovercrafter at earthlink.net
Thu Oct 22 16:39:50 UTC 2009


RSYNC for files generally works fine. I been doing this on a pretty 
heavily trafficked site for a year now. Of course our setup is one 
server for Drupal then another for static content (with some core hacks 
to rewrite all static requests to a static. subdomain). To get around 
the RSYNC lag I have mod_rewrite on the static server. Basically if the 
file isn't there then it sends the request back to the main server.

As I said - this works fine in a single php/single static server setup. 
Add in more than 1 PHP server and you got problems, unless you keep each 
visitor assigned to the same server at all times. The biggest problem 
comes with CSS or JS aggregation. If I make a request and it goes to 
server 1 and the CSS/JS are aggregated, then the request to load those 
files ends up on server 2 chances are great (very great) that RSYNC 
wouldn't have caught up yet and now I got a 404 on those files, 
resulting in a very borked site.

Having said that, the best solution for multiple PHP servers is using a 
shared mount of some sort (NFS, SSHFS, etc.). That way if my initial 
request goes to server 1, the CSS and JS aggregate files are created and 
instantly available on all servers.

Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net



Pierre Rineau wrote:
> You have be careful with rsync, at least you don't update code files.
> But if you do, you'll have to put your site in maintenance mode to avoid
> users running drupal code whenever files are desync with database, this
> could lead to serious issues (may be it could have side effect with
> uploaded files too).
>
> Pierre.
>
> On Thu, 2009-10-22 at 19:16 +0800, Ivan Working wrote:
> > Hi all,
> > 
> > My company is using 3 Drupal servers with load balancer to distribute
> > the load.
> > The problem is the files in sites/default/files folder need to be
> > synchronized
> > among these 3 Drupal servers.
> > 
> > I am thinking of using rsync for this purpose but I heard rsync may
> > not be the
> > best way to do it since it shouldn't delete the files so the number of
> > files will
> > grow quickly.
> > 
> > Has anybody used rsync to synchronize the files?
> > Is there a better method to synchronize files in sites/default/files?
> > 
> > Thank you in advance!
> > 
> > Cheers,
> > Ivan
> > 
> > 
> > 
> > ______________________________________________________________________
> > New Windows 7: Find the right PC for you. Learn more.
> > -- 
> > [ Drupal support list | http://lists.drupal.org/ ]
>
>   


More information about the support mailing list