summaryrefslogtreecommitdiffstats
path: root/debian/ctdb.example/nfs-kernel-server
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:47:31 +0000
commit236cb75e4430569627585a5818d9ce9bc85640f8 (patch)
treef84b5c0335eb76eb9df1e6c2c0004d7d9667c6e4 /debian/ctdb.example/nfs-kernel-server
parentAdding upstream version 2:4.17.12+dfsg. (diff)
downloadsamba-236cb75e4430569627585a5818d9ce9bc85640f8.tar.xz
samba-236cb75e4430569627585a5818d9ce9bc85640f8.zip
Adding debian version 2:4.17.12+dfsg-0+deb12u1.debian/2%4.17.12+dfsg-0+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/ctdb.example/nfs-kernel-server')
-rw-r--r--debian/ctdb.example/nfs-kernel-server/98-nfs-static-ports.conf5
-rwxr-xr-xdebian/ctdb.example/nfs-kernel-server/enable-nfs.sh186
-rw-r--r--debian/ctdb.example/nfs-kernel-server/nfs.conf20
-rw-r--r--debian/ctdb.example/nfs-kernel-server/quota5
-rw-r--r--debian/ctdb.example/nfs-kernel-server/services16
5 files changed, 232 insertions, 0 deletions
diff --git a/debian/ctdb.example/nfs-kernel-server/98-nfs-static-ports.conf b/debian/ctdb.example/nfs-kernel-server/98-nfs-static-ports.conf
new file mode 100644
index 0000000..9bb3227
--- /dev/null
+++ b/debian/ctdb.example/nfs-kernel-server/98-nfs-static-ports.conf
@@ -0,0 +1,5 @@
+# CTDB: /etc/sysctl.d/98-nfs-static-ports.conf
+
+fs.nfs.nfs_callback_tcpport = 32764
+fs.nfs.nlm_tcpport = 32768
+fs.nfs.nlm_udpport = 32768
diff --git a/debian/ctdb.example/nfs-kernel-server/enable-nfs.sh b/debian/ctdb.example/nfs-kernel-server/enable-nfs.sh
new file mode 100755
index 0000000..2346601
--- /dev/null
+++ b/debian/ctdb.example/nfs-kernel-server/enable-nfs.sh
@@ -0,0 +1,186 @@
+#!/bin/bash -e
+
+base="/usr/share/doc/ctdb/examples/nfs-kernel-server/"
+logfile="/tmp/enable-ctdb-nfs.$$.log" ; touch $logfile ;
+ghostname=""
+
+# functions ---------
+
+die() { echo error: $@; echo ; exit 1; };
+getout() { echo exit: $@; echo ; exit 0; };
+stopservice() { echo stopping $1... ; systemctl stop $1 2>&1 >> $logfile 2>&1; }
+disableservice() { echo disabling $1... ; systemctl disable $1 2>&1 >> $logfile 2>&1; }
+startservice() { echo starting $1... ; systemctl start $1 2>&1 >> $logfile 2>&1; }
+sysctlrefresh() { echo refreshing sysctl... ; sysctl --system 2>&1 >> $logfile 2>&1; }
+
+backupfile() {
+ echo backing up $1
+ [ -f $1.prvctdb ] && die "backup file $1 already exists!"
+ [ -f $1 ] && cp $1 $1.prvctdb || true
+}
+
+renamefiles() {
+ for f; do
+ [ -f "$f" ] || continue
+ echo "Renaming $f to $f.prvctdb"
+ mv "$f" "$f".prvctdb
+ done
+}
+
+checkservice() {
+ (systemctl list-unit-files | grep -q $1.service) || die "service $1 not found"
+}
+
+replacefile() {
+
+ origfile=$1
+ replfile=$2
+
+
+ [ ! -f $base/$origfile ] && die "coult not find $base/$origfile"
+
+ echo replacing $replfile...
+ cp $base/$origfile $replfile
+}
+
+appendfile() {
+
+ origfile=$1
+ replfile=$2
+
+ [ ! -f $base/$origfile ] && die "coult not find $base/$origfile"
+
+ echo appending $base/$origfile to $replfile...
+ cat $base/$origfile >> $replfile
+}
+
+execnfsenv() {
+
+ file=$1 ; [ -f $file ] || due "inexistent file $file";
+
+ echo executing $file...
+
+ $file 2>&1 >> $logfile 2>&1;
+}
+
+fixnfshostname() {
+
+ type nfsconf > /dev/null 2>&1 || die "nfsconf(8) not found"
+
+ if [ "$ghostname" == "" ]; then
+ echo "What is the FQDN for the public IP address of this host ?"
+ echo -n "> "
+ read ghostname
+ fi
+
+ echo "Setting $ghostname in nfs.conf..."
+ nfsconf --set statd name "$ghostname"
+}
+
+# end of functions --
+
+[ $UID != 0 ] && die "you need root privileges"
+
+echo """
+This script will enable CTDB NFS HA by changing the following files:
+
+(1) /etc/nfs.conf ( replace )
+(2) /etc/nfs.conf.d/*.conf ( rename )
+(3) /etc/services ( append )
+(4) /etc/sysctl.d/98-nfs-static-ports.conf ( create )
+(5) /etc/default/quota ( replace )
+
+and disabling the following services, as they will be managed
+by ctdb:
+
+(1) rpcbind
+(2) nfs-kernel-server
+(3) rpc.rquotad
+
+Obs:
+ - replaced files keep previous versions as "file".prevctdb
+ - dependant services will also be stopped
+"""
+
+while true; do
+ echo -n "Do you agree with this change ? (N/y) => "
+ read answer
+ [ "$answer" == "n" ] && getout "exiting without any changes"
+ [ "$answer" == "y" ] && break
+done
+
+
+echo "checking requirements..."
+
+checkservice nfs-kernel-server
+checkservice quota
+checkservice rpcbind
+
+echo "requirements okay!"
+echo
+
+backupfile /etc/nfs.conf
+renamefiles /etc/nfs.conf.d/*.conf
+backupfile /etc/services
+backupfile /etc/default/quota
+echo
+
+set +e
+
+stopservice ctdb.service
+stopservice quota.service
+stopservice nfs-kernel-server.service
+stopservice rpcbind.service
+stopservice rpcbind.socket
+stopservice rpcbind.target
+echo
+
+disableservice ctdb.service
+disableservice quota.service
+disableservice nfs-kernel-server.service
+disableservice rpcbind.service
+disableservice rpcbind.socket
+disableservice rpcbind.target
+echo
+
+set -e
+
+replacefile nfs.conf /etc/nfs.conf
+replacefile 98-nfs-static-ports.conf /etc/sysctl.d/98-nfs-static-ports.conf
+replacefile quota /etc/default/quota
+echo
+
+appendfile services /etc/services
+echo
+
+fixnfshostname
+echo
+
+sysctlrefresh
+echo
+
+echo """Finished! Make sure to configure properly:
+
+ - /etc/exports (containing the clustered fs to be exported)
+ - /etc/ctdb/nodes (containing all your node private IPs)
+ - /etc/ctdb/public_addressess (containing public addresses)
+
+A log file can be found at:
+
+ - /tmp/enable-ctdb-nfs.$$.log
+
+Remember:
+
+ - to place a cluster lock in /etc/ctdb/ctdb.conf:
+ ...
+ [cluster]
+ cluster lock = /clustered.filesystem/.reclock
+ ...
+
+And, make sure you enable ctdb service again:
+
+ - systemctl enable ctdb.service
+ - systemctl start ctdb.service
+
+Enjoy!
+"""
diff --git a/debian/ctdb.example/nfs-kernel-server/nfs.conf b/debian/ctdb.example/nfs-kernel-server/nfs.conf
new file mode 100644
index 0000000..5cfa13a
--- /dev/null
+++ b/debian/ctdb.example/nfs-kernel-server/nfs.conf
@@ -0,0 +1,20 @@
+[general]
+pipefs-directory = /run/rpc_pipefs
+
+[lockd]
+port = 32768
+udp-port = 32768
+
+[mountd]
+manage-gids = 1
+port = 32767
+
+[nfsd]
+threads = 8
+vers4 = n
+
+[statd]
+ha-callout = /etc/ctdb/statd-callout
+name = @NFS_HOSTNAME@
+outgoing-port = 32766
+port = 32765
diff --git a/debian/ctdb.example/nfs-kernel-server/quota b/debian/ctdb.example/nfs-kernel-server/quota
new file mode 100644
index 0000000..00eab66
--- /dev/null
+++ b/debian/ctdb.example/nfs-kernel-server/quota
@@ -0,0 +1,5 @@
+# Set to "true" if warnquota should be run in cron.daily
+run_warnquota=
+
+# Add options to rpc.rquotad here
+RPCRQUOTADOPTS="-p 32769"
diff --git a/debian/ctdb.example/nfs-kernel-server/services b/debian/ctdb.example/nfs-kernel-server/services
new file mode 100644
index 0000000..3ff6b1d
--- /dev/null
+++ b/debian/ctdb.example/nfs-kernel-server/services
@@ -0,0 +1,16 @@
+# CTDB: fixed NFS/RPC service ports for clustering
+
+rpc.nfsd 2049/tcp # RPC nfsd
+rpc.nfsd 2049/udp # RPC nfsd
+rpc.nfs-cb 32764/tcp # RPC nfs callback
+rpc.nfs-cb 32764/udp # RPC nfs callback
+rpc.statd-bc 32765/tcp # RPC statd broadcast
+rpc.statd-bc 32765/udp # RPC statd broadcast
+rpc.statd 32766/tcp # RPC statd listen
+rpc.statd 32766/udp # RPC statd listen
+rpc.mountd 32767/tcp # RPC mountd
+rpc.mountd 32767/udp # RPC mountd
+rpc.lockd 32768/tcp # RPC lockd/nlockmgr
+rpc.lockd 32768/udp # RPC lockd/nlockmgr
+rpc.quotad 32769/tcp # RPC quotad
+rpc.quotad 32769/udp # RPC quotad