RAC & MULTIPATHING
Vous devez installer un cluster Oracle RAC sur linux et vous ne savez pas comment paramétrer multipath.conf.
Ou plus simplement, vous souhaitez utiliser ASM en mode NORMAL REDUNDANCY sur deux baies de stockage et vous chercher un moyen d’identifier la baie de stockage dans le nom du disque. Dans un cas comme dans l’autre, les deux procédures présentées ici vous simplifieront la vie !
La première, namedisk.ksh, affecte à chaque disque un alias qui identifie la baie de stockage tout en garantissant la persistance et la cohérence du nommage au sein du cluster.
Il suffit de l’exécuter sur chacun des membres du cluster à l’initialisation de celui-ci, ou après ajout de volumes sur la baie de stockage.
NAMEDISK.KSH
#! /bin/ksh
NewDisk () {
TARGET=`echo $2 | awk -F : '{ print $1":"$2":"$3 ; }'`
cat $FCLOG | awk 'BEGIN { FOUND=0 ; }
FOUND == 0 && $0 ~ /Class Device path.*target'$TARGET'/ { FOUND=1 ; next ; }
FOUND == 1 { print $3 ; exit ; }' | sed -e 's/"//g' |read baie
echo " multipath { "
echo " wwid $1"
echo " alias ASM_${baie}_${3}"
echo " path_grouping_policy failover"
echo " }"
}
export FCLOG=/tmp/fc.$$
systool -c fc_transport -v > $FCLOG
typeset -i WRITE
WWID=
WRITE=0
multipath -l | sed -e 's/[()]//g' | awk '
$3 ~ /dm-/ { wwid=$2 ; next; }
$0 ~ /hwhandler/ { next ; }
$0 ~ /round-robin/ { next ; }
{ print wwid,$2 ;}' | sort -k 1,2 | while read wwid suffixe
do
[ -z "${WWID}" ] && { WRITE=1; echo "multipaths {" ; }
if [ "${WWID}" = "${wwid}" ]
then :
else WWID=${wwid} ;
NewDisk ${WWID} ${suffixe} ${WRITE}
let WRITE=WRITE+1
fi
done> /tmp/multipath.new
rm -f $FCLOG
if [ $WRITE -gt 1 ]
then { echo "}" >> /tmp/multipath.new ; }
else echo nothing to do
exit 0
fi
cp /etc/multipath.conf /etc/multipath.conf.old
sed -e '/^multipath/,/^}/d' /etc/multipath.conf.old > /etc/multipath.conf
echo "" >> /etc/multipath.conf
cat /tmp/multipath.new >> /etc/multipath.conf
service multipathd restart
exit 0
multipaths {
multipath {
wwid 3600508b40006ca5900037000017f0000
alias ASM_0x50001fe1500fe510_1
path_grouping_policy failover
}
multipath {
wwid 3600508b40006ca590003700001880000
alias ASM_0x50001fe1500fe510_2
path_grouping_policy failover
}
multipath {
wwid 3600508b40006ca5900037000018d0000
alias ASM_0x50001fe1500fe510_3
path_grouping_policy failover
}
}
INITVOL.KSH
#! /bin/ksh
cat <<! > /etc/init.d/init.oravol
#!/bin/ksh
Status() {
ls -l /dev/mapper/ASM* | while read line
do
echo \$line | grep oracle|grep dba > /dev/null 2>&1 || { return 1 ; }
done
}
Start() { chown oracle:dba /dev/mapper/ASM* ; }
RETVAL=0
case "\$1" in
start) Start ;;
stop) : ;;
restart) Start ;;
status) Status ; RETVAL=\$?
;;
*) echo "Usage: \$0 {start|stop|status|restart}"
RETVAL=3
esac
exit \$RETVAL
!
chmod +x /etc/init.d/init.oravol
rm -f /etc/rc5.d/S60oravol /etc/rc3.d/S60oravol
echo ln -s /etc/init.d/init.oravol /etc/rc5.d/S60oravol
ln -s /etc/init.d/init.oravol /etc/rc5.d/S60oravol
echo ln -s /etc/init.d/init.oravol /etc/rc3.d/S60oravol
ln -s /etc/init.d/init.oravol /etc/rc3.d/S60oravol
Ensuite, la procédure /etc/init.d/init.oravol sera automatiquement exécutée au démarrage du serveur (level 3 ou level 5).



Cerise sur le gateau, on n’a plus besoin d’ASMlib !