RAC 11GR2 叢集啟動指令碼
讀書筆記:
11GR2版本
來看看11GR2版本叢集的/etc/inittab檔案。
#run xdm in runlevel 5
x:5:respawn:/etc/X11/perfdm -nodaemon
h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null
只有指令碼/etc/init.d/init.ohasd被呼叫,10G版本的之前三個指令碼已經不存在了,下面是指令碼的內容。
[[email protected] ~]# find / -name init.ohasd
/u01/app/11.2.0/grid/crs/utl/init.ohasd
/u01/app/11.2.0/grid/crs/init/init.ohasd
^C
[[email protected] ~]# cat /u01/app/11.2.0/grid/crs/init/init.ohasd
######### Instantiated Variables #########
ORA_CRS_HOME=/u01/app/11.2.0/grid
export ORA_CRS_HOME
HAS_USER=root
SCRBASE=/etc/oracle/scls_scr
#limits
CRS_LIMIT_CORE=unlimited
CRS_LIMIT_MEMLOCK=unlimited
CRS_LIMIT_OPENFILE=65536
##########################################
.................................................................................
### CLI tools
BASENAME=/bin/basename
HOSTN=/bin/hostname
SU=/bin/su
CHOWN=/bin/chown
ECHO=/bin/echo
SLEEP=/bin/sleep
EXPRN=/usr/bin/expr
CUT=/usr/bin/cut
CAT=/bin/cat
GREP=/bin/grep
ohasd所需的環境變數和命令被定義
........................................................................
### Main ###
# Retrieve name of the platform
PLATFORM=`/bin/uname`
MY_HOST=`tolower_host`
# Default path for SCR control files.
AUTORUNFILE=/etc/oracle/scls_scr/$MY_HOST/root/ohasdrun
LOGMSG="/bin/logger -puser.err"
LOGERR="/bin/logger -puser.alert"
case $PLATFORM in
Linux) LOGGER="/usr/bin/logger"
if [ ! -f "$LOGGER" ];then
LOGGER="/bin/logger"
fi
LOGMSG="$LOGGER -puser.err"
LOGERR="$LOGGER -puser.alert"
CUT="/bin/cut"
;;
HP-UX)
NAMEDPIPE=/tmp/.oracle/npohasd
;;
AIX)
NAMEDPIPE=/tmp/.oracle/npohasd
;;
SunOS)
.....................................................................................
# enable HA by default on most unix platforms
case $PLATFORM in
Linux)
GIPCD_PASSTHROUGH=false
export GIPCD_PASSTHROUGH
;;
HP-UX)
GIPCD_PASSTHROUGH=false
export GIPCD_PASSTHROUGH
;;
SunOS)
GIPCD_PASSTHROUGH=false
export GIPCD_PASSTHROUGH
根據不同的平臺設定對應的環境變數
................................................................................
case $1 in
'run')
................................................................................
Esac
可以看到輸入的引數只有唯一值是run,它用於啟動ohasd.bin守護程序。
小結
根據10g和11gR2版本的叢集管理軟體的啟動指令碼之間的不同,能看到從11gR2版本開始,GI啟動指令碼變成了只有一個,而且指令碼的長度也大大地減少,10g版本存在的問題得到了解決。換句話說,ohasd bin成為了叢集啟動的根(root)守護程序。下面是一個檢視 ohasd.bin守護程序的ps命令:
[[email protected] ~]# vi /u01/app/11.2.0/grid/crs/init/init.ohasd
[[email protected] ~]# ps -ef | grep has
root 1079 1 0 08:55 ? 00:00:00 /bin/sh /etc/init.d/init.ohasd run
root 1878 1 0 08:56 ? 00:00:10 /u01/app/11.2.0/grid/bin/ohasd.bin reboot