I have a CentOS 6.3 client that needs to access NFS storage. There are two NFS servers that serve up the same content stored on a SAN with a clustered filesystem. How do I set up CentOS to failover to the backup NFS server if needed? When I Google, I keep reading that Linux does not support this, but that would be strange since there is plenty of information out there on how to set up a clustered Linux NFS server farm...

  • 4
    Would using Heartbeat and a floating virtual IP help you out? It's not limited to NFS, but a more general approach. see for example Arch Linux wiki: Simple IP Failover with Heartbeat. – gertvdijk Dec 19 '12 at 23:52
  • 2
    I second the comment by @gertvdijk. You might be able to configure active/passive failover by configuring the same IP address and hostname on the main server and the failover server. That is how commercial NFS filers work such as EMC VG-2 storage gateway. – Dmitri Chubarov Dec 20 '12 at 8:49
  • heartbeat would work but this is a strange particular situation. The NFS server is a OS X 10.8 Xsan setup and they removed heartbeat in 10.8 (10.7 had it). – Doug Jan 4 '13 at 3:07

That sounds like a job for the automount(8) daemon. See the autofs(5) man page (from the autofs rpm) under "Replicated Server". I believe if you add a line like

fileserv host1,host2:/server/export/point

to /etc/auto.misc on your client and (re-)start the autofs service, your NFS storage will show up under /misc/fileserv. You could add -ro as mount options if you want to mount read only (or other mount options of course).

| improve this answer | |
  • that did it sure enough! thanks. It would be cool if it could revert back to the main server when its back online, but this works well enough to get the job done. – Doug Jan 4 '13 at 3:05

The Right Way(tm) to do this is with GlusterFS, which is a scale out filesystem that runs in userspace atop an underlying filesystem like NFS or CIFS.

All this sounds impressive and complicated, but it's actually really simple to set up. It honestly should take you less than 15 minutes. You'd have two servers, each with a "brick" (unit of storage) defined. A volume would then be defined within this server pool. Replication of the data between the servers happens automatically, as does failover on the client if one of the servers dies.

| improve this answer | |
  • Another Right Way is Ceph RBD. – Snowball Jul 2 '14 at 15:02
  • You can use MooseFS. It's open source and fault-tolerant distributed file system. – TechGeek Jun 14 '18 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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