Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/setup_nfs_ha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ function setup_required_packages
systemctl stop nfs-kernel-server
systemctl disable nfs-kernel-server

# Setup static port assignments for mountd, nlm (tcp), and nlm (udp) respectively:
sed -i 's/^\(RPCMOUNTDOPTS="--manage-gids\)"/\1 -p 2000"/g' /etc/default/nfs-kernel-server
cat <<EOF > /etc/sysctl.d/30-nfs-ports.conf
fs.nfs.nlm_tcpport = 2001
fs.nfs.nlm_udpport = 2002
EOF
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much @kermat for your PR! I've been working on this exactly like this, but I'm stuck at sysctl --system step (according to https://wiki.debian.org/SecuringNFS). Don't we need to do that? Yet, if I do that when nfs-kernel-server is stopped, it doesn't appear to work at all. In fact, sysctl -p /etc/sysctl.d/30-nfs-ports.conf complains that there's no directory /proc/fs/nfs/…. Can you confirm that we don't need to run the sysctl command? Well, I'm just about to do that anyway, so I'll probably find that out. Thanks again!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that creating /etc/sysctl.d/xxx.conf for NFS doesn't work, because the /proc/fs/nfs directory usually doesn't exist when the sysctl --system is run. And I confirmed that creating /etc/modprobe.d/lockd.conf with the static ports assigned does work. So I'll revise this code after accepting/merging your PR. Thanks much!


# We need to install the "azure-lb" command separately if the resource-agents package didn't have it.
pushd /usr/lib/ocf/resource.d/heartbeat
if [ ! -e azure-lb ]; then
Expand Down Expand Up @@ -226,4 +233,4 @@ NFS_EXPORT_PATH=${DRBD_MOUNT_POINT}/moodle # TODO Allow different export dir na

setup_corosync_and_pacemaker_for_nfs $NODE1IP $NODE2IP $DRBD_RESOURCE_NAME $DRBD_DEVICE_PATH $DRBD_MOUNT_POINT $NFS_EXPORT_PATH "$NFS_CLIENTS_IP_RANGE"

echo "NFS-HA setup succeeded. NFS_EXPORT_PATH=${NFS_EXPORT_PATH}, NFS_CLIENT_SPEC=${NFS_CLIENT_SPEC}"
echo "NFS-HA setup succeeded. NFS_EXPORT_PATH=${NFS_EXPORT_PATH}, NFS_CLIENT_SPEC=${NFS_CLIENT_SPEC}"