Replying to list, as one suggestion does involve the database :-)

On Fri, Jan 9, 2009 at 3:03 AM, xufeng <xuf...@yuanjie.net> wrote:

> Hi all,
> Recently I am redesigning our website architecture.
> I have two servers located at Location_A and Location_B serving the same
> http://www.ourexample.com and loadbalancing via DNS round-robin.Location_A
> and Location_B are connected via Internet(NOT in A LAN).
> The mysql database can be "synchronized" via master-master replication as
> far as we have seen,but we are now faced with file synchronization
> problem(I
> mean the files uploaded by users from Location_A and Location_B cannot see
> each other  "immediately".)


Your options depend mainly on speed and reliability between A and B, but are
mostly what you already indicated; comments below.


> 1.NFS over Internet for file sharing


Works, but keep in mind that you'll have one server and one client. This
works, but will be relatively slow for the client, and will not provide
failover. You *could* probably build half a master-master setup using
UnionFS, and then provide close-to-failover using scheduled
synchronisations.


> 2.sshfs


Roughly the same comments as NFS, but on the plus side, more secure and on
the minus side, slower


> 3.inotify(our system's kernel does not support this and we donot want to
> risk upgrading our kernel as well)


This would still require you do do some important scripting, anyway.


> 4.drbd in active-active mode


For drbd to work well in active mode, you still need a networked filesystem,
that is, an FS that is aware of modifications on the other side - remember
that metadata is cached in the local VFS layer.

If you're willing to pay, you could have a look at GPFS, PeerFS or any other
number of cluster FSes. These will immediately sync metadata, if not
necessarily the actual data.



> 5 or any other solutions


Well, yes, but only if your file needs remain reasonable: you could
ostensibly dump the files in BLOBs in your database, thus leveraging the
already existing synchronisation. I strongly recommend you to then also
implement a local FS cache layer for them, so that you only need to fetch
them from DB once.


As said before, though, "immediate" availability strongly depends on the
quality of the link between your sites. The advantage of a clustered
filesystem, is that it can guarantee that the file is available everywhere
as soon as it's been comitted to disk (although the actual first fetch might
still be slow).


I hope this helps you a little,
Johan


-- 
Celsius is based on water temperature.
Fahrenheit is based on alcohol temperature.
Ergo, Fahrenheit is better than Celsius. QED.

Reply via email to