Posted on 2012-05-25 12:26
云云 阅读(809)
评论(0) 编辑 收藏
最近工作中用到hadoop集群
由于刚开始使用 会出很多问题 经常会得启会删除日志会改配置
但是删除日志 是一件很麻烦的事 集群节点越多 删除日志 越累
索性写一个脚本来删除日志
通过ssh到各个节点 使用这个脚本前提是已经配置ssh无密码登录
dir=$1
case $1 in
hadoop)
echo "will delete hadoop cluster logs ...."
rm -rf /usr/hadoop/hadoop-1.0.1/logs/*
echo "delete hadoop master logs done "
for slave in $(cat /usr/hadoop/hadoop-1.0.1/conf/slaves);do
echo "delete $slave hadoop logs"
ssh $slave "rm -rf /usr/hadoop/hadoop-1.0.1/logs/*"
done
echo "delete hadoop cluster logs done ..."
;;
hbase)
echo "will delete hbase cluster logs ...."
rm -rf /usr/hadoop/hbase-0.92.1/logs/*
echo "delete master hbase logs...."
for hslave in $(cat /usr/hadoop/hbase-0.92.1/conf/regionservers);do
echo "delete $hslave hbase logs "
ssh $hslave "rm -rf /usr/hadoop/hbase-0.92.1/logs/*"
done
echo "delete hbase cluster logs done ...."
;;
*)
echo "usage params : {hadoop|hbase} "
esac