This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-deployment-ansible-d…/Apache Hadoop/2.7.1/hdfs/role/templates/daemonscript/keephdfsslave.j2

43 lines
885 B
Plaintext
Raw Normal View History

#!/bin/bash
#
# netconsole This loads the netconsole module with the configured parameters.
#
# chkconfig:123456 40 60
# description: keephdfsslave
source /etc/profile
PRO_NAME=keephdfsslave
INS_DIR={{ deploy_dir }}
#版本
VERSION={{ hadoop_version }}
case $1 in
start)
slave=`ps -ef | grep dae-hdfsslave.sh | grep -v grep | wc -l`
if [ $slave -lt 1 ];then
nohup $INS_DIR/$VERSION/sbin/dae-hdfsslave.sh > /dev/null 2>&1 &
fi
;;
stop)
HAS_KEEP_SHELL=`ps -ef | grep dae-hdfsslave.sh | grep -v grep | awk '{print $2}'`
if [ $HAS_KEEP_SHELL ];then
echo "守护进程PID$HAS_KEEP_SHELL"
kill -9 $HAS_KEEP_SHELL
fi
sh $INS_DIR/$VERSION/sbin/hadoop-daemon.sh stop namenode > /dev/null
sh $INS_DIR/$VERSION/sbin/hadoop-daemon.sh stop zkfc > /dev/null
;;
status)
hdfs haadmin -getServiceState nn2
hdfs dfsadmin -report
;;
* )
echo "use keephdfsslave [start|stop|status]"
;;
esac