Operating System - HP-UX
1828983 Members
2216 Online
109986 Solutions
New Discussion

hosting nfs mount in a package

 
Aaron_82
Frequent Advisor

hosting nfs mount in a package

I have a three node cluster. In some of the packages I will need to export a nfs mount to other servers. How do I make sure that the nfs mount is exported to the package IP and it will failover to the other nodes?
9 REPLIES 9
Geoff Wild
Honored Contributor

Re: hosting nfs mount in a package

By making sure you use the hanfs.sh script.

You can copy it from /opt/cmcluster/nfs

See docs here:

http://docs.hp.com/hpux/ha/index.html

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sridhar Bhaskarla
Honored Contributor

Re: hosting nfs mount in a package

Hi,

I would suggest you use NFS toolkit extension for ServiceGuard. Look at the following document for more information on NFS over ServiceGuard.

http://docs.hp.com/hpux/onlinedocs/B5140-90011/B5140-90011.html

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Aaron_82
Frequent Advisor

Re: hosting nfs mount in a package

Yae, I'm aware of the toolkit. There are multiple packages on each server so I can't have the NFS server in it's own package. I just wanted to export NFS mounts in each package and I want to use the IP of the respective package. So if one package were to failover it would only brings it's NFS mount over.
Kenneth Platz
Esteemed Contributor

Re: hosting nfs mount in a package

In the simplest terms, you would simply need to do an exportfs -i [options] /path/to/export in order to export the filesystem, and an exportfs -u /path/to/export to unmount the filesystem. You would want to make sure that these are being called from your customer_defined_run_commands and customer_defined_halt_commands, respectively.

You would also, obviously, need to make sure that the appropriate mount points were also included in the package so they failed over correctly.

You don't export TO a specific IP address, however you want to make sure that when you are mounting these filesystems, you mount FROM the package IP address.
I think, therefore I am... I think!
Geoff Wild
Honored Contributor

Re: hosting nfs mount in a package

We have the same - we have 1 nfs package (for /usr/sap/trans) but we also export from withing the SAP/Oracle package - all you do is customize your package control script.

This is how we do it:

In main package script:

function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some command.
/etc/cmcluster/PRODBCI/sapdbci.cntl startDBCI PRO
test_return 51
}

In the sapdbci.cntl, we source some files:

CONF_FILE=${CONF_FILE:-/etc/cmcluster/PRODBCI/sap.conf}
FUNC_FILE=${FUNC_FILE:-/etc/cmcluster/sap.functions}
CUST_FILE=${CUST_FILE:-/etc/cmcluster/customer.functions}

In the sap.conf:

# RECOMMENDATION:
# In a multi SAP Systems environment, none of the R/3 packages should own
# /usr/sap/trans. Otherwise a package halt effects all other running R/3
# systems. It is a better choice to use a dedicated nfs package for
# /usr/sap/trans. If you nevertheless decide that this package should own
# /usr/sap/trans, be aware that you should grant access from all
# hosts of the additional R/3 Systems, too.
#
# Add the /export/informix/${SAPSYSTEMNAME} lines if you use an INFORMIX
# database without using local INFORMIX executables.
#

IPFS[0]=${DBRELOC}; SXFS[0]=/export/sapmnt/${SAPSYSTEMNAME}
OPFS[0]="root=prodbf:procif:svr003f:svr004f:svr110f:svr111f:svr112f,access=prodbf:procif:svr003f:svr004f:svr110f:svr111f:svr112f"
IPFS[1]=${DBRELOC}; SXFS[1]=/export/data/sap/PROD/ARCHIVE
OPFS[1]="access=prodbf:procif:svr003f:svr004f:svr110f:svr111f:svr112f"
IPFS[2]=${CIRELOC}; SXFS[2]=/export/APPL
OPFS[2]="root=prodbf:procif:svr003f:svr004f:svr110f:svr111f:svr112f:procif:svr003f:svr004f:svr110f:svr111f:svr112f"
IPFS[3]=${CIRELOC}; SXFS[3]=/export/usr/sap/xfer
OPFS[3]="root=prodbf:procif:svr003f:svr004f:svr110f:svr111f:svr112f:procif:svr003f:svr004f:svr110f:svr111f:svr112f"


Here's the export/unexport functions:

###################################################################
#
# Function: export_nfs
#
# Exports NFS directories which are owned by this package.
# The access to needed directories is verified.
#
# Parameters:
#
###################################################################
function export_nfs
{
INR=0
for I in ${IPFS[@]}
do
is_ip_local $I
if [ $? -ne 0 ]; then
LogMsg "(export_nfs): Export ${SXFS[$INR]}"
while [ . ];
do
ERROR=`exportfs -i -o ${OPFS[$INR]} ${SXFS[$INR]} 2>&1`
if [ -n "`echo ${ERROR}|grep \"xtab in use\"`" ]; then
LogMsg "(export_nfs): xtab in use - export delayed"
sleep 2
elif [ -n "${ERROR}" ]; then
ErrLogMsg "(export_nfs): ${ERROR}"
exit 22
else
break
fi
done
else
is_node_alive $I
if [ $? -ne 0 ]; then
LogMsg "(export_nfs): NFS-Server $I for ${SXFS[$INR]} responding"
#LogMsg "(export_nfs): Remote export of ${SXFS[$INR]} from $I"
##remsh $I -n "exportfs -i -o ${OPFS[$INR]} ${SXFS[$INR]}"
#remsh $I -n "/usr/sbin/exportfs -i -o ${OPFS[$INR]} ${SXFS[$INR]}"
#if [ $? -ne 0 ]; then
# exit 1
#fi
else
ErrLogMsg "(export_nfs): NFS-Server $I for ${SXFS[$INR]} NOT responding"
exit 12
fi
fi
(( INR = $INR + 1 ))
done

# additionally check for transport directory, which always has to be there
count=1
while [ ${count} -le ${DELAY_INTERVALS} ]; do
(( seconds = $count * 10 ));
if [ ${seconds} -ge 60 ]; then
seconds=60
fi
is_node_alive ${TRANSRELOC}
if [ $? -eq 1 ]; then
if [ ! -f ${TRANSDIR}/bin/TPPARAM ]; then
LogMsg "(export_nfs): WARNING: transport directory invalid - delayed"
LogMsg "(export_nfs): waiting ${seconds} secs for automounter"
else
LogMsg "(export_nfs): transport directory valid"
return
fi
else
LogMsg "(export_nfs): NFS-Server ${TRANSRELOC} for ${TRANSDIR} NOT responding - delayed"
LogMsg "(export_nfs): waiting ${seconds} secs for NFS-Package to start"
fi
sleep ${seconds}
(( count = $count + 1 ));
done
ErrLogMsg "(export_nfs): attempt to connect NFS-Server ${TRANSRELOC} failed"
exit 7
}


########################################################################
#
# Function: unexport_nfs
#
# UnExports NFS directories which are locally mounted at this node.
# This function is required for all nfs server nodes (usually just one,
# the database server).
#
# Parameters:
#
########################################################################
function unexport_nfs
{
INR=0
for I in ${IPFS[@]}
do
is_ip_local $I
if [ $? -ne 0 ]; then
LogMsg "(unexport_nfs): Unexport ${SXFS[$INR]}"
while [ . ];
do
ERROR=`exportfs -u ${SXFS[$INR]} 2>&1`
if [ -n "`echo ${ERROR}|grep \"xtab in use\"`" ]; then
LogMsg "(unexport_nfs): xtab in use - unexport delayed"
sleep 2
elif [ -n "${ERROR}" ]; then
ErrLogMsg "(unexport_nfs): ${ERROR}"
exit 23
else
break
fi
done
else
LogMsg "(unexport_nfs): ${SXFS[$INR]} local at ${I} - excluded"
fi
(( INR = $INR + 1 ))
done
}

I hope the cut and paste worked...

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Aaron_82
Frequent Advisor

Re: hosting nfs mount in a package

Will this work?

customer_defined_run_commands
exportfs -i -o rw=nfsclient /a20/utl

customer_defined_halt_commands
exportfs -u /a20/utl
Aaron_82
Frequent Advisor

Re: hosting nfs mount in a package

Kenneth,
How do you mount FROM the package IP?
Aaron_82
Frequent Advisor

Re: hosting nfs mount in a package

Kenneth,
I meant how do you export FROM the package IP.
Geoff Wild
Honored Contributor

Re: hosting nfs mount in a package

As far as your exportfs in the customer defined functions - should work - but I would create a test package and play with that.

See the following docs for more info:

http://docs.hp.com/hpux/pdf/B3936-90065.pdf

http://docs.hp.com/hpux/pdf/B5140-90012.pdf

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.