Centos – Good NFS multipath solution

centosfailovermultipathnfs

I have a couple of servers serving exactly the same content through NFS to several webfarms, all the servers involved are running CentOS 5

The content between both NFS servers is replicated using Unison (tried drbd in the past, killed the performance badly)

To distribute load I'm mounting a different NFS server from each of the farms.

  • Webfarm1 mounts NFS1
  • Webfarm2 mounts NFS2

The only problem I have is when one of the servers crashes I would like to automatically remount the content from the other NFS server until the server recovers and then returns to the first server after a grace time.

Before I start writing such application I would like to know if there's any Opensource solution already available that does something close to what I'm intending, all the intelligence of the application should be on the client side (server side solutions have all been tested and discarded (heartbeat, drbd, etc…) since I want to use both NFS servers in an active-active solution.

Also it should be important that all servers in a webfarm are hitting the same NFS server, otherwise I would incur in some nasty replication issues.

Thanks beforehand for your help!

Best Answer

Have a look at the RedHat Cluster Suite NFS Cookbook, subtitled "Setting up a Load­Balanced NFS Cluster with Failover Capabilities". I think this may have some good suggestions, if it's not exactly what you're looking for.

You can take the ideas presented in that document and implement them using Pacemaker/Corosync, which I find much easier to work with than the legacy RedHat cluster tools.

You're basically asking for an active/active cluster with automatic failover. Since you're serving out from two independent -- but synchronized -- copies of the data, you've actually sidestepped most of the complicating issues that crop up (involving locking and other state synchronization) if you're actually trying to create a load-balancing NFS front-end to some sort of shared storage (e.g., a cluster filesystem like GFS).