HiiHahWIKI - making some notes for... -
Hadoop:スレーブのstderrログを収集する
をテンプレートにして作成
開始行:
*Hadoop:スレーブのstderrログを収集する [#qb384531]
必要だったので作りました。
こんな感じです。
■harvestJobErrLog.sh
#!/bin/bash
if [ $# -ne 1 ]
then
echo "ERROR: No input args"
exit 255
fi
JOB_ID=$1
OUTDIR=${JOB_ID}/
mkdir ${OUTDIR}
while read target_host
do
ssh -n ${target_host} "ls -1 /var/log/hadoop/userlogs/...
while read tlog
do
tfilename=`echo ${tlog} | awk -F/ '{print $6$7}'`
scp ${target_host}:/${tlog} ${OUTDIR}${tfilename}_$...
done < tmperrlist
echo "${target_host} is done"
done < hostlist.txt
slaveのログのディレクトリは適宜変更して使ってください。
このシェルとは別にhostlist.txtファイルが必要です。
■hostlist.txt
slave01
slave02
slave03
以下のような感じで実行できます。
|実行ユーザ|hadoop(スレーブサーバにssh認証設定がされてい...
|実行形式| harvestJobErrLog.sh JOB_ID|
|引数のJOB_IDについて|頭の「job_」を取った値。|
実行例は以下の通り。
harvestJobErrLog.sh 201103251444_1959
すると、引数で指定したジョブIDでディレクトリを掘って、適...
手抜きシェルでごめんなさい。
終了行:
*Hadoop:スレーブのstderrログを収集する [#qb384531]
必要だったので作りました。
こんな感じです。
■harvestJobErrLog.sh
#!/bin/bash
if [ $# -ne 1 ]
then
echo "ERROR: No input args"
exit 255
fi
JOB_ID=$1
OUTDIR=${JOB_ID}/
mkdir ${OUTDIR}
while read target_host
do
ssh -n ${target_host} "ls -1 /var/log/hadoop/userlogs/...
while read tlog
do
tfilename=`echo ${tlog} | awk -F/ '{print $6$7}'`
scp ${target_host}:/${tlog} ${OUTDIR}${tfilename}_$...
done < tmperrlist
echo "${target_host} is done"
done < hostlist.txt
slaveのログのディレクトリは適宜変更して使ってください。
このシェルとは別にhostlist.txtファイルが必要です。
■hostlist.txt
slave01
slave02
slave03
以下のような感じで実行できます。
|実行ユーザ|hadoop(スレーブサーバにssh認証設定がされてい...
|実行形式| harvestJobErrLog.sh JOB_ID|
|引数のJOB_IDについて|頭の「job_」を取った値。|
実行例は以下の通り。
harvestJobErrLog.sh 201103251444_1959
すると、引数で指定したジョブIDでディレクトリを掘って、適...
手抜きシェルでごめんなさい。
ページ名: