本文共 3090 字,大约阅读时间需要 10 分钟。
简介:
jps(Java Virtual Machine Process Status Tool)是JDK 1.5提供的一个显示当前所有java进程pid的命令,简单实用,非常适合在linux/unix平台上简单察看当前java进程的一些简单情况。详细参数请参考:注:jps命令有个地方很不好,似乎只能显示当前用户的java进程,显示其他用户很容易报错 -- process information unavailable下面我们模拟下Hadoop生产实战中 jps 真死、假死的问题
[root@hadoop000 ~]# jps4868 DataNode5062 SecondaryNameNode5256 Jps4717 NameNode[root@hadoop000 ~]# kill -9 $(pgrep -f hadoop-2.8.1)[root@hadoop000 ~]# jps4868 -- process information unavailable5062 -- process information unavailable4717 -- process information unavailable5279 Jps[root@hadoop000 ~]# ps -ef|grep 4868root 5301 1630 0 14:39 pts/0 00:00:00 grep 4868#进程不存在 可去/tmp/hsperfdata_hadoop文件夹删除残留文件[root@hadoop000 ~]# cd /tmp/hsperfdata_hadoop/[root@hadoop000 hsperfdata_hadoop]# lltotal 96-rw------- 1 hadoop hadoop 32768 May 19 14:38 4717-rw------- 1 hadoop hadoop 32768 May 19 14:38 4868-rw------- 1 hadoop hadoop 32768 May 19 14:38 5062[root@hadoop000 hsperfdata_hadoop]# rm *rm: remove regular file `4717'? yesrm: remove regular file `4868'? yesrm: remove regular file `5062'? yes#显示正确[root@hadoop000 hsperfdata_hadoop]# jps5304 Jps
#hadoop用户[hadoop@hadoop000 hadoop-2.8.1]$ pwd/opt/software/hadoop-2.8.1[hadoop@hadoop000 hadoop-2.8.1]$ sbin/start-dfs.sh[hadoop@hadoop000 hadoop-2.8.1]$ jps10004 SecondaryNameNode9655 NameNode10219 Jps9806 DataNode#root用户[root@hadoop000 ~]# jps10004 -- process information unavailable9655 -- process information unavailable10187 Jps9806 -- process information unavailable[root@hadoop000 hsperfdata_hadoop]# ps -ef|grep 10004hadoop 10004 1 3 15:07 ? 00:00:08 /usr/local/java1.8/bin/java -Dproc_secondarynamenode -Xmx1000m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/software/hadoop-2.8.1/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/opt/software/hadoop-2.8.1 -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,console -Djava.library.path=/opt/software/hadoop-2.8.1/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/opt/software/hadoop-2.8.1/logs -Dhadoop.log.file=hadoop-hadoop-secondarynamenode-hadoop000.log -Dhadoop.home.dir=/opt/software/hadoop-2.8.1 -Dhadoop.id.str=hadoop -Dhadoop.root.logger=INFO,RFA -Djava.library.path=/opt/software/hadoop-2.8.1/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS org.apache.hadoop.hdfs.server.namenode.SecondaryNameNoderoot 10256 7539 0 15:11 pts/3 00:00:00 grep 10004##看到进程存在 请不要去/tmp目录下做删除操作 用su切换到hadoop用户下 jps即显示正常
转载于:https://blog.51cto.com/10814168/2118219