jps命令的使用和pid文件的注意事項

2.jps命令的真相
2.1位置哪裏的
[hadoop@hadoop002 hadoop-2.6.0-cdh5.7.0]$ which jps
/usr/java/jdk1.8.0_45/bin/jpsjava

2.2對應的進程的標識文件在哪 /tmp/hsperfdata_進程用戶名稱node

[hadoop@hadoop002 hsperfdata_hadoop]$ pwd
/tmp/hsperfdata_hadoop
[hadoop@hadoop002 hsperfdata_hadoop]$ ll
total 96
-rw------- 1 hadoop hadoop 32768 Feb 16 20:35 1086
-rw------- 1 hadoop hadoop 32768 Feb 16 20:35 1210
-rw------- 1 hadoop hadoop 32768 Feb 16 20:35 1378
[hadoop@hadoop002 hsperfdata_hadoop]$ oop

2.3
root用戶看全部用戶的jps結果
普通用戶只能看本身的this

2.4 process information unavailable
真假判斷: ps -ef|grep namenode 真正判斷進程是否可用spa


[root@hadoop002 ~]# jps
1520 Jps
1378 -- process information unavailable
1210 -- process information unavailable
1086 -- process information unavailable
[root@hadoop002 ~]#
[root@hadoop002 ~]#
[root@hadoop002 ~]#
[root@hadoop002 ~]# orm

生產環境:
hadoop: hdfs組件 hdfs用戶
root用戶或sudo權限的用戶取獲取進程


kill: 人爲 進程在Linux看來是耗內存最大的 自動給你kill內存

kill -9 +進程號  殺死進程之後  jps查看,進程仍是存在,處在一個假死狀態,可是若是使用kill +進程號,再jps查看,進程就會被殺死而且不會再存在hadoop

[root@hadoop002 tmp]# rm -rf hsperfdata_hadoop
[root@hadoop002 tmp]#
[root@hadoop002 tmp]# jps
1906 Jps
[root@hadoop002 tmp]# it

3.pid文件 集羣進程啓動和中止要使用的文件

[root@hadoop001 tmp]# pwd
/tmp

[root@hadoop001 tmp]# ll

-rw-rw-r-- 1 hadoop hadoop 5 Feb 16 20:56 hadoop-hadoop-datanode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Feb 16 20:56 hadoop-hadoop-namenode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Feb 16 20:57 hadoop-hadoop-secondarynamenode.pid
Linux在tmp命令 按期刪除一些文件和文件夾 30天週期

[hadoop@hadoop001 hadoop]$ vi hadoop-env.sh 
# The directory where pid files are stored. /tmp by default.
# NOTE: this should be set to a directory that can only be written to by
# the user that will run the hadoop daemons. Otherwise there is the
# potential for a symlink attack.
export HADOOP_PID_DIR=${HADOOP_PID_DIR}

export HADOOP_PID_DIR=${HADOOP_PID_DIR}
export HADOOP_SECURE_DN_PID_DIR=${HADOOP_PID_DIR}
export HADOOP_PID_DIR=/data/tmp


mkdir /data/tmp
chmod -R 777 /data/tmp

 

爲了不pid文件在tmp中被刪除,從新建一個路徑/data/tmp,並給他777權限 chmod -R 777 /data/tmp,把pid文件放在這裏邊就不會被刪除了

相關文章
相關標籤/搜索