I have a Webserver, and I would like to move some of the static files for the web application off to a remote server, yet still have them accessible.

Is there a way to have (Server A) mount a folder from (Server B) as if it were a local drive? Or simply a mounted partition? Basically so my web app can write to the remote drive via something like /mount/remotefolder ??

Both servers are running CentOS, however in two geographically separate locations.

link|improve this question
feedback

2 Answers

sshfs is what you're looking for. http://fuse.sourceforge.net/sshfs.html -- you can even use fstab entries to automount it on boot, or set it not to mount, but then you can just do mount /pre/defined/mount/point to mount it. sshfs can be slow, but it's definitely secure. It requires fuse to be active, either as a kernel module/compiled into kernel, or as a userspace program.

I have the following line in my .bashrc:

alias xxr-sfs="sshfs xxr:/var/www/localhost/htdocs ~/xxr"

And xxr is defined in my ~/.ssh/config file:

Host xxr
HostName xxr
user mark

(stuff above has obviously been renamed for my privacy)

Then if I want to mount it, I just type xxr-sfs to mount it.

link|improve this answer
Thank you, i'll take a look in to it. – Joel Jul 11 '11 at 13:07
feedback

The short answer to your question would be NFS, I think. Alternatively, for a more fancy setup, you could have the two servers share a DRBD volume.

However, I wonder what's wrong with HTTP as a file access protocol? Can't server B have it's own web server and serve its files for itself? Split your webapp so that the part that processes the files resides on server B?

Update:

I didn't read OP carefully enough. If "geographically separate locations" means long latency, both drbd and nfs may be suboptimal, depending on the exact use case. If there is more than a 50 ms latency between the two locations, I would try to use different web servers that both talk directly to the end user, if possible.

link|improve this answer
Bandwidth in Australia is quite pricey, so I would like to move the non-critical elements such as Video and Media to a US based server whilst keeping the critical elements of the web app locally. – Joel Jul 11 '11 at 13:08
feedback

Your Answer

 
or
required, but never shown

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