您好,登錄后才能下訂單哦!
簡介:
jps(Java Virtual Machine Process Status Tool)是JDK 1.5提供的一個顯示當前所有java進程pid的命令,簡單實用,非常適合在linux/unix平臺上簡單察看當前java進程的一些簡單情況。
詳細參數請參考:https://www.cnblogs.com/toSeeMyDream/p/5747412.html
注:jps命令有個地方很不好,似乎只能顯示當前用戶的java進程,顯示其他用戶很容易報錯 -- process information unavailable
下面我們模擬下Hadoop生產實戰中 jps 真死、假死的問題
[root@hadoop000 ~]# jps
4868 DataNode
5062 SecondaryNameNode
5256 Jps
4717 NameNode
[root@hadoop000 ~]# kill -9 $(pgrep -f hadoop-2.8.1)
[root@hadoop000 ~]# jps
4868 -- process information unavailable
5062 -- process information unavailable
4717 -- process information unavailable
5279 Jps
[root@hadoop000 ~]# ps -ef|grep 4868
root 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]# ll
total 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'? yes
rm: remove regular file `4868'? yes
rm: remove regular file `5062'? yes
#顯示正確
[root@hadoop000 hsperfdata_hadoop]# jps
5304 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]$ jps
10004 SecondaryNameNode
9655 NameNode
10219 Jps
9806 DataNode
#root用戶
[root@hadoop000 ~]# jps
10004 -- process information unavailable
9655 -- process information unavailable
10187 Jps
9806 -- process information unavailable
[root@hadoop000 hsperfdata_hadoop]# ps -ef|grep 10004
hadoop 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.SecondaryNameNode
root 10256 7539 0 15:11 pts/3 00:00:00 grep 10004
##看到進程存在 請不要去/tmp目錄下做刪除操作 用su切換到hadoop用戶下 jps即顯示正常
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。