1.pid文件 进程启动 停止的所需的文件
默认配置为/tmp目录下
[hadoop@Hadoop001 tmp]$ ll
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 04:19 hadoop-hadoop-datanode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 04:19 hadoop-hadoop-namenode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 04:19 hadoop-hadoop-secondarynamenode.pid
[hadoop@Hadoop001 tmp]$ jps
4882 NameNode
4982 DataNode
5177 SecondaryNameNode
5583 Jps
[hadoop@Hadoop001 tmp]$ cat hadoop-hadoop-datanode.pid
4982
2.pid文件的重要性
[hadoop@Hadoop001 tmp]$ rm -f hadoop-hadoop-secondarynamenode.pid
[hadoop@Hadoop001 hadoop]$ sbin/stop-dfs.sh
19/07/04 04:59:55 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Stopping namenodes on [Hadoop001]
Hadoop001: stopping namenode
Hadoop001: stopping datanode
Stopping secondary namenodes [Hadoop001]
Hadoop001: no secondarynamenode to stop
19/07/04 05:00:11 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[hadoop@Hadoop001 hadoop]$ jps
5923 Jps
5177 SecondaryNameNode
如果删除pid文件,则会导致停止服务的时候有问题。同时linux对/tmp目录有30天删除不常用文件或文件夹的情况。所以需要修改pid文件存储路径
特别注意:如果是apache版本的需要修改pid配置路径信息,如果是cdh版本的就不用关心了。
3.修改pid文件存储路径
[root@Hadoop001 data]# mkdir -p /data/tmp
[root@Hadoop001 data]# chmod -R 777 /data/tmp
[hadoop@Hadoop001 hadoop]$ vi hadoop-env.sh
export HADOOP_PID_DIR=/data/tmp
[hadoop@Hadoop001 hadoop]$ cd /data/tmp/
[hadoop@Hadoop001 tmp]$ ll
total 12
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 05:09 hadoop-hadoop-datanode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 05:09 hadoop-hadoop-namenode.pid
-rw-rw-r-- 1 hadoop hadoop 5 Jul 4 05:09 hadoop-hadoop-secondarynamenode.pid
网友评论