# Sync files between servers

## petterg

I would like to set up a redundant fileserver. What would be the best way to go?

The users may update files on both servers so there need to be a two-way sync.

I was thinking if one server mounted a NFS share on the other everything would be fine until the one beeing the NFS server dies. To make sure data is saved on both servers I could use rsync to mirror the NFS server to the NFS client. When the NFS server dies the mirrored filearea could be mounted on the NFS client where the server area used to be, but how would the client know when to trigger the script that would unmount NFS and mount the mirrored area in it's place?

What other ways are there to get around this?

----------

## derverstand

rsync ?

----------

## nielchiano

I don't think it will work that way: your umount of the NFS-mount will hang forever (or at least until some timeout, which will be minutes!)

You could run rsync every x minutes, but if a user has uploaded data to both servers within this x-minutes-interval, rsync might get confused.

----------

## derverstand

My setup is: LVM and software raid on the main server and a second server, which is rsynced once a day.

/BR

----------

## petterg

I'll have hw raid 5 and dual power on both servers. Still there is only a matter of time before one will go down.

Would there be any way to make NFS unmount faster? maybe some kind of script trying to access a file on NFS share every 10sec, and if it doesn't get it it should force unmount?

----------

## derverstand

n00b-comment: Wasn't there something like: start portmapd and it will work faster? :/

----------

## HeissFuss

You should look in HA cluster options.  Ideally you'd have your services running on the primary with the heartbeat running on both nodes.  If the secondary loses the heartbeat of the primary it'll take over through scripts that you configure.  For storage your best solution is to have it external and accessible to both nodes (NAS, iSCSI or SAN.)  If you really want both nodes to have access to the data you may want to look into GFS (a shared cluster filesystem which allows multiple nodes safe RW access to the same filesystem.)

----------

