0

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.

5 Answers 5

2

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.

1

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.

1

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

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

0

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.

0

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.