How to do client side NFS failover in Linux?

14,437

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).

Share:
14,437

Related videos on Youtube

Doug
Author by

Doug

Updated on September 18, 2022

Comments

  • Doug
    Doug almost 2 years

    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...

    • gertvdijk
      gertvdijk over 11 years
      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.
    • Zachw6
      Zachw6 over 11 years
      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.
    • Doug
      Doug over 11 years
      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
    Doug over 11 years
    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.
  • Snowball
    Snowball almost 10 years
    Another Right Way is Ceph RBD.
  • TechGeek
    TechGeek about 6 years
    You can use MooseFS. It's open source and fault-tolerant distributed file system.
  • uav
    uav almost 4 years
    Ceph is slow on VMs. Gluster/Heketi also and it is not yet suitable for many small files and/or many write operations, e.g. databases or Redis - I have learned through pain. I have not tried MooseFS yet. I am now back to NFS, autofs and lsyncd.