comm=$1
if [ -z $comm ]; then
hosts=`cat /opt/sohuhadoop/conf/slaves`
for host in $hosts
do
file=`echo $0|perl -F"/" -anle 'print $F[-1]' `
scp -q $0 $host:/tmp/ ;
echo $host mapred.Child
ssh $host "sh /tmp/$file run"
done ;
elif [ $comm = "run" ];then
source /etc/profile;
for c in `jps -ml |grep org.apache.hadoop.mapred.Child|perl -nle 'print $1 if /^(\d+).*/' `
do
jmap -histo $c |perl -ne '
$sum+=$1 if /:\s+\d+\s+(\d+)/;
END{
$mem=$sum/1024/1024;printf (" '$c' >%dm",$mem);
}
'
ps -A -opid,etime|grep $c |perl -nle '
if(/(.*)\s(\d+-\d+:\d+)/){
print " run=$2 ; kill";
system("kill -9 $1");
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载