How to handle uploaded files in HA cluster?

Hi,
i am planning to build HA cluster for rails applications, using
guideline


from Tim Loosen.

Database replication should be easy with MySQL, I am currently using
master-slave replication for backups, so configuring master-master
wouldn’t be a big deal (as I hope). But I am wondering how to handle
file uploads?
First way which come into me mind was cross-exporting upload
directories via NFS and slightly modifying file_column plugin.
Another way is to store files in database, so MySQL replication will
be used and than perform some way of caching (reading big files from
database again and again doesn’t look like a good idea to me).

Any ideas how to solve this?

Regards

Láïa

Use Amazon S3.

Then you are clustering DB but don’t need to cluster/replicate FS.

It’s not a good idea to keep files in the DB as a rule. Of course, you
can, but you’d have to really think through it.

-Danimal

On Apr 13, 2008, at 1:16 AM, durchanek wrote:

First way which come into me mind was cross-exporting upload
directories via NFS and slightly modifying file_column plugin.
Another way is to store files in database, so MySQL replication will
be used and than perform some way of caching (reading big files from
database again and again doesn’t look like a good idea to me).

Any ideas how to solve this?

Never ever store images in the database especially if you are doing
replication or master master, sotring images in the db is very
inefficient and will completely hose replication on the regular.

NFS can work but has locking issues and is not POSIX compliant and is
also fairly slow. If you have a SAN then you can use GFS from the red
hat cluster suite to get a posix compliant clustered filesystem.

Cheers-

Thanks for replication explanation. GFS looks like a good way, but I
think that it has two drawbacks:

  • introducing another single-point-of-failure
  • SAN requirement

I would like to make this happen with two servers only + loadbalancer
and pretty low-cost - applications are not heavy loaded, but failover
would be a great feature.
Is there eg. some way how to replicate directory via rsync/SSH/
whatever through daemon? There will be only a minimum file-upload
operations, so having not-so-realtime replication of files would be
sufficient.

Cheers

Láïa

On Mon, 2008-04-14 at 03:46 -0700, durchanek wrote:

operations, so having not-so-realtime replication of files would be
sufficient.

How about using something like:

http://www.danga.com/mogilefs/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs