3

Consider this:

  • I have one fast server with a Drupal installation but this server does not have access to a lot of disk space.

  • I have another server that isn't quite as fast but does have access to lot of disk space.

My drupal server is hosting a blog and some photo galleries. I would like my drupal server to use the file server to store its images and files.

How can I achieve such a thing? The file server can be accessed through ftp or sftp.

I'm considering using the storage api for this, it seems like a good fit (?) but I'm not sure how to implement it. The documentation seems a bit off.

Also, the blog uses the wysiwyg module + the media module to allow for image uploads in the body field. How can I make this functionality work with the storage api?

Is there anyone with experience in this field that can help me out?

6

If all you're looking to do is offload your Files directory to a different server, and you have complete access to both servers, I would suggest you create an NFS (network drive) mapping to the storage server.

Then you can simply change your Public/Private files directory to /mynfs/drupal-files instead of /drupal/sites/default/files, which will pretty transparently offload storage to your other server.

You'll want to do some research into NFS and its alternatives that do the same thing. I'm not familiar enough with the Storage API to know if it will work in your situation. After researching it a little bit it seemed like you would have to do a decent amount of work as well.

  • 2
    Storage API will work for this situation as far as I know, but this is a much simpler (and probably more robust) solution – Clive Aug 9 '12 at 14:16
  • I'm inclined to agree. The problem is that I do not have full access to the servers. And I don't think I'll be able to implement this. Thanks for your suggestion though. – Mike Aug 9 '12 at 20:02
  • 1
    I tried NFS approach with success. I found a detailed tutorial here: digitalocean.com/community/tutorials/… – Sinan Erdem Jan 19 '16 at 22:28
4

If you're using D7 I'm pretty sure you can write your own file stream wrapper to achieve this too http://drupal.org/node/560424. More work than just setting your file system up differently but thought you might like to know that it exists.

The obvious problem is that transferring every image from one server to the other through FTP as you need them will be really slow if your servers aren't in the same room.. Even imagecache won't help you there as the "cached" images are stored in the public files directory.

  • That seems like a nice project! Thank you for the input. – Mike Aug 9 '12 at 20:03
1

One of the simplest ways to do this is to set up an S3 bucket as your CDN. Make sure you have enabled curl (sudo apt-get install php5-curl) and then install:

Library: awssdk Modules: libraries amazons3 awssdk

The visit the documentation page for amazons3 at https://www.drupal.org/node/1371166

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.