Big Data----The fast positioning of PID process numbers in Hadoop

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.