Tuning Manager Software インストールガイド
Solaris上にクラスタシステムを構築した場合,クラスタソフトウェアからサービスの起動,停止,および状態監視をするツール(またはコマンド)を登録する必要があります。ここでは,各プログラムプロダクトによってインストールされる,サービスを操作するコマンドを利用して,クラスタソフトウェアに登録するためのコマンドとします。
クラスタソフトウェアに登録されたサービスが,正しく実行されていることを確認する仕様は,クラスタソフトウェアごとに異なります。ここではSolaris 9とSun Cluster 3.1の組み合わせのクラスタ環境を前提に,インストールされるコマンドを内部で実行し,起動,停止,および状態監視をするサンプルシェルスクリプトを示します。
- 注意
- 次に示すサンプルシェルスクリプトは,各プログラムプロダクトによってインストールされる,サービスを操作するコマンドを/etc/init.dディレクトリにコピーしていることを前提としています。コピーの手順については,「7.3.4 クラスタソフトウェアへの登録(Sun Clusterの場合)」を参照してください。
- 次に示すサンプルシェルスクリプトを実行すると,サンプルシェルスクリプトと同じディレクトリに実行ログファイルが作成されます。ファイル名は,実行するサンプルシェルスクリプトのファイル名のあとに,”.log”が付加された名前で作成されます。サンプルシェルスクリプトを実行するごとに,ログファイルに追加されていくためファイルサイズが増加します。運用時には,過去の不要なログは削除してください。
- この節の構成
- A.1.1 共通コンポーネントのサービス
- A.1.2 Performance Reporterのサービス
- A.1.3 Tuning Manager serverのサービス
- A.1.4 HiRDBのサービス
(1) HBase Storage Mgmt Common Service
HBase Storage Mgmt Common Serviceの起動,停止,状態監視用のシェルスクリプト(sc_hicommand-SSOS.sh)
#!/bin/sh # # Sample sc_hicommand-SSOS # # Usage: sc_hicommand-SSOS [start|stop|status] # # This Script executes /etc/init.d/hicommand-SSOS internally. set -x exec >> ./$0.log 2>&1 echo "#####" `date` "#####" ALIVE_VALUE=0 DOWN_VALUE=1 exec_cmd() { echo `date "+%y/%m/%d %H:%M:%S " `"exec : $*" # Execute Command with operand $* # Set return value to RC RC=$? echo `date "+%y/%m/%d %H:%M:%S " `"exec-end: $* (RC=$RC)" if [ $RC -ne 0 ]; then if [ $RC -ne 1 ]; then exit $RC fi fi } # Switch operation according to the first operand of this shell. case $1 in start) exec_cmd "/etc/init.d/hicommand-SSOS start" ;; stop) exec_cmd "/etc/init.d/hicommand-SSOS stop" ;; status) /etc/init.d/hicommand-SSOS status # The result is equal to 1 if [ $? -eq 1 ]; then # running RET_CODE=$ALIVE_VALUE else # not running RET_CODE=$DOWN_VALUE fi exit $RET_CODE ;; *) echo "Invalid argument" exit 1 esac exit 0(2) HBase Storage Mgmt Web Service
HBase Storage Mgmt Web Serviceの起動,停止,状態監視用のシェルスクリプト(sc_hicommand-CWS.sh)
#!/bin/sh # # Sample sc_hicommand-CWS # # Usage: sc_hicommand-CWS [start|stop|status] # # This Script executes /etc/init.d/hicommand-CWS internally. set -x exec >> ./$0.log 2>&1 echo "#####" `date` "#####" ALIVE_VALUE=0 DOWN_VALUE=1 exec_cmd() { echo `date "+%y/%m/%d %H:%M:%S " `"exec : $*" # Execute Command with operand $* # Set return value to RC RC=$? echo `date "+%y/%m/%d %H:%M:%S " `"exec-end: $* (RC=$RC)" if [ $RC -ne 0 ]; then if [ $RC -ne 1 ]; then exit $RC fi fi } # Switch operation according to the first operand of this shell. case $1 in start) exec_cmd "/etc/init.d/hicommand-CWS start" ;; stop) exec_cmd "/etc/init.d/hicommand-CWS stop" ;; status) /etc/init.d/hicommand-CWS status # The result is equal to 1 if [ $? -eq 1 ]; then # running RET_CODE=$ALIVE_VALUE else # not running RET_CODE=$DOWN_VALUE fi exit $RET_CODE ;; *) echo "Invalid argument" exit 1 esac exit 0
A.1.2 Performance Reporterのサービス
Performance Reporterの起動,停止,状態監視用のシェルスクリプト(hicommand-PR.sh)
#!/bin/sh # # Sample hicommand-PR.sh # # Usage: hicommand-PR.sh [start|stop|check] set -x exec >> ./$0.log 2>&1 echo "#####" `date` "#####" ALIVE_VALUE=0 DOWN_VALUE=1 exec_cmd() { echo `date "+%y/%m/%d %H:%M:%S " `"exec : $*" $* RC=$? echo `date "+%y/%m/%d %H:%M:%S " `"exec-end: $* (RC=$RC)" if [ $RC -ne 0 ]; then if [ $RC -ne 1 ]; then exit $RC fi fi } case $1 in start) exec_cmd "/etc/init.d/cluster_hicommand-PR start" ;; stop) exec_cmd "/etc/init.d/cluster_hicommand-PR stop" ;; check) /etc/init.d/cluster_hicommand-PR check if [ $? -eq 1 ]; then # running RET_CODE=$ALIVE_VALUE else # not running RET_CODE=$DOWN_VALUE fi exit $RET_CODE ;; *) echo "Invalid argument" exit 1 esac exit $ALIVE_VALUE
A.1.3 Tuning Manager serverのサービス
HiCommand Suite TuningManagerの起動,停止,状態監視用のシェルスクリプト(hicommand-TM.sh)
#/bin/sh # # Sample hicommand-TM.sh # # Usage: hicommand-TM.sh [start|stop|check] set -x exec >> ./$0.log 2>&1 echo "#####" `date` "#####" ALIVE_VALUE=0 DOWN_VALUE=1 exec_cmd() { echo `date "+%y/%m/%d %H:%M:%S " `"exec : $*" $* RC=$? echo `date "+%y/%m/%d %H:%M:%S " `"exec-end: $* (RC=$RC)" if [ $RC -ne 0 ]; then if [ $RC -ne 1 ]; then exit $RC fi fi } case $1 in start) exec_cmd "/etc/init.d/cluster_hicommand-TM start" ;; stop) exec_cmd "/etc/init.d/cluster_hicommand-TM stop" ;; check) /etc/init.d/cluster_hicommand-TM check if [ $? -eq 1 ]; then # running RET_CODE=$ALIVE_VALUE else # not running RET_CODE=$DOWN_VALUE fi exit $RET_CODE ;; *) echo "Invalid argument" exit 1 esac exit $ALIVE_VALUE
HiRDBの起動,停止,状態監視用のシェルスクリプト(hirdb_start.sh,hirdb_stop.sh,hirdb_probe.sh)
(1) HiRDBの起動用のシェルスクリプト(hirdb_start.sh)
#!/bin/sh PATH=/usr/sbin:/usr/bin:$PDDIR/bin:.:/usr/cluster/bin export PATH PDDIR=/opt/HiCommand/Base/HDB PDCONFPATH=$PDDIR/conf LD_LIBRARY_PATH=$PDDIR/lib PDHOST=<論理ホスト名> export PDDIR PDCONFPATH LD_LIBRARY_PATH PDHOST $PDDIR/bin/pdstart /etc/init.d/hirdb_probe.sh(2) HiRDBの停止用のシェルスクリプト(hirdb_stop.sh)
#!/bin/sh PATH=/usr/sbin:/usr/bin:$PDDIR/bin:.:/usr/cluster/bin export PATH PDDIR=/opt/HiCommand/Base/HDB PDCONFPATH=$PDDIR/conf LD_LIBRARY_PATH=$PDDIR/lib PDHOST=<論理ホスト名> export PDDIR PDCONFPATH LD_LIBRARY_PATH PDHOST $PDDIR/bin/pdstop -f(3) HiRDBの監視用のシェルスクリプト(hirdb_probe.sh)
#!/bin/sh ps -ef | grep root | grep pdprcd | awk -F' ' '{print $8}' | grep pdprcd if [ $? = 0 ];then echo "exit 0" exit 0 else echo "exit 100" exit 100 fi
All Rights Reserved. Copyright© 2010, 2014, Hitachi, Ltd.