frequently managed and monitored, shell programming is required, directly to the process kill or restart operation. We need to quickly navigate to the PID number of each process
PID is stored in the/tmp directory by default
PID content is process number
Ps-ef|grep Hadoop appears PID a,b,c may be manslaughter b,c
[email protected] sbin]$ cat hadoop-daemon.sh |grep PID
#HADOOPPIDDIR the PID files are stored. /tmp by default.
pid= $HADOOP _pid_dir/hadoop-$HADOOP _ident_string-$command. PID
If [-f $pid]; Then
If kill-0 cat $pid
>/dev/null 2>&1; Then
Echo $command running as process cat $pid
. Stop it first.
Echo $! > $pid
If [-f $pid]; Then
Target_pid=cat $pid
Rm-f $pid
The official-given SH script is also a process kill object by reading the contents of the PID file
We directly to the PID file number is our process PID
[[email protected] tmp]$ ls *.pid
Hadoop-hadoop-datanode.pid Yarn-hadoop-nodemanager.pid
Hadoop-hadoop-namenode.pid Yarn-hadoop-resourcemanager.pid
Hadoop-hadoop-secondarynamenode.pid Yarn-hdfs-resourcemanager.pid
[Email protected] tmp]$
[email protected] tmp]$ cat Hadoop-hadoop-datanode.pid
8990
[Email protected] tmp]$ JPS
12060 Jps
9193 Secondarynamenode
9566 NodeManager
8990 DataNode
9450 ResourceManager
kill-0 cat /tmp/hadoop-hadoop-datanode.pid
---Shell common kill pid method '
Big Data----The fast positioning of PID process numbers in Hadoop