Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Right now I'm using NFS (network file system) to mount a file server's web root to two webservers.

Seems to me NFS eats up a lot of resources. Is there a better way to sync files on webservers? I know you can run rsync every few seconds, but not sure this is the best way either.

share|improve this question

closed as not constructive by sysadmin1138 Jun 6 '12 at 21:40

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers 5

up vote 2 down vote accepted

Are the files modified in both places or are they managed centrally?

If the files may be modified on any of the servers, then NFS may be the wise choice.

If files are to be managed centrally, then you could use some version control system (like Subversion) too keep the data and checkout the changes regularly on the servers.

If the files are modified on one machine and you want them the same on the other then you can use rsync – after any change or in crontab. Rsync won't use much resources when there are no changes to propagate.

share|improve this answer

If this is a Linux system (which I'm guessing it is) I'd strongly suggest DRBD. It allows you to replicate a file-system across the network to another machine.

You can create a GFS2 or OCFS2 (clustering) file-system and you can mount both shares in dual-primary mode. When a change is made on one of the systems, it's instantly available on the other.

share|improve this answer

Another option is unison it is very similar to rsync. Unison works better for two way sync. For example: if files change on both places, unison will do a better job than rsync.

Both will work over ssh. Both will be low on resources.

*I use it/them for directories with over 200K files. I sync every 5 minutes. I've used both and see no performance difference.

share|improve this answer

What about shared storage? You could setup openfiler or freenas on another box and mount filesystem through iSCSI. If you use filesystem only for reads, you could use ext3 or xfs or any similar fs and mount filesystem readonly. For rw access you need clustered fs such as OCFS2 or GFS2 (and optionally clvmd if you use LVM)

As Andy suggested, you could also use DRDB. But it has its limitations. Main limitation is limit to only 2 servers (Master-Slave or Master-Master). It is possible to add third server, but it is more complicated.

share|improve this answer

Take a look at csync2, it is geared more for this type of thing.

http://oss.linbit.com/csync2/

share|improve this answer