# CARP+HAST+NFS



## alphaniner (Apr 28, 2015)

Edit: Switching to CARP triggers rather than the IFNET triggers described in the handbook solved the NFS issues.

I'm trying to set up a NAS with high availability using the aforementioned services.

First off, regarding the devd triggers and example script in the handbook. Together they can change the role of the node on which the link state changes, but that has no effect on the other node. In the short run I added remote-master and remote-slave cases to the script, which are called in the slave and master cases, respectively. The standard cases call the remote cases via ssh:

```
...
case "$1" in
  master)
...
  remote_node=$( hastctl status |awk 'NR==2 {print $5}' )
  ssh $remote_node /usr/local/sbin/carp-hast-switch remote-slave 2>&1
...
```

The remote cases differ from the standard cases only in the lack of the ssh command. It's pretty terrible but it was the first thing that came to mind, and it seems to work. I'm sure there must be a better way though.

It works at least in theory. The HAST nodes swap roles, the HAST volume is mounted and nfs starts. Shares are visible from the client (Arch Linux) after the transition according to showmount. But existing NFS connections become useless until the nodes transition back to the original state, failing with either 'stale file handle' or input/output errors. And I have no idea where to go from here.


----------



## usdmatt (Apr 29, 2015)

Hopefully someone can suggest otherwise, but when I looked into this a while back, each system generated a unique NFS filesystem ID for the export. Because the export on both servers had different ID numbers, the mounted file system was basically useless when the NFS server was changed, and needed to be re-mounted, putting a huge roadblock in front of HAST+CARP+NFS.

On Linux there's an `fsid` option in /etc/exports that allows you to specify the ID (so you can use the same number on both NFS servers), although I have no experience on whether this actually works and allows the clients to switch between servers without interruption.


----------



## alphaniner (Apr 29, 2015)

I found a thread to that effect when I was initially troubleshooting, but couldn't find a solution either.

Happily, I've since gotten the mount to survive the failover (in a testing environment anyway), so apparently it's not an issue after all. Once I've ironed out a few more kinks I'll post the details.


----------



## alphaniner (May 5, 2015)

I've been busy lately but should get around to posting further details soon.


----------



## alphaniner (May 19, 2015)

Still crazy busy, so I've just dumped everything into the attached zip file. Along with the handbook page on HAST, hopefully things will be more or less self-explanatory. One thing to note, due to the changes in the way the CARP interface works between versions 9 and 10, the trigger will only work in 10.


----------

