小編給大家分享一下HDFS中pid文件存儲(chǔ)在哪,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
創(chuàng)新互聯(lián)主營(yíng)山丹網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都App制作,山丹h5小程序定制開發(fā)搭建,山丹網(wǎng)站營(yíng)銷推廣歡迎山丹等地區(qū)企業(yè)咨詢
1. pid文件默認(rèn)存儲(chǔ)在/tmp目錄中,pid文件的內(nèi)容為進(jìn)程號(hào)
[hadoop@hadoop002 ~]$ cd /tmp
[hadoop@hadoop002 tmp]$ pwd
/tmp
[hadoop@hadoop002 tmp]$ ll
total 132
drwxrwxr-x. 4 hadoop hadoop 4096 May 22 12:46 hadoop-hadoop
-rw-rw-r--. 1 hadoop hadoop 5 May 23 11:00 hadoop-hadoop-datanode.pid
-rw-rw-r--. 1 hadoop hadoop 5 May 23 11:00 hadoop-hadoop-namenode.pid
-rw-rw-r--. 1 hadoop hadoop 5 May 23 11:00 hadoop-hadoop-secondarynamenode.pid
drwxr-xr-x. 2 hadoop hadoop 4096 May 23 13:17 hsperfdata_hadoop
drwxrwxr-x. 3 hadoop hadoop 4096 May 23 11:00 Jetty_0_0_0_0_50070_hdfs____w2cu08
drwxrwxr-x. 4 hadoop hadoop 4096 May 23 11:05 Jetty_0_0_0_0_8042_node____19tj0x
drwxrwxr-x. 3 hadoop hadoop 4096 May 23 11:01 Jetty_hadoop002_50090_secondary____.xoi5bj
drwxrwxr-x. 4 hadoop hadoop 4096 May 23 11:05 Jetty_hadoop002_8088_cluster____jy43fd
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 12:43 Jetty_localhost_33164_datanode____.86mfre
drwxrwxr-x. 3 hadoop hadoop 4096 May 21 16:31 Jetty_localhost_34452_datanode____57ccs7
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 13:28 Jetty_localhost_35801_datanode____1320ou
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 11:14 Jetty_localhost_41633_datanode____.reuty8
drwxrwxr-x. 3 hadoop hadoop 4096 May 21 17:17 Jetty_localhost_43514_datanode____do382o
drwxrwxr-x. 3 hadoop hadoop 4096 May 23 11:00 Jetty_localhost_54437_datanode____.slqxa8
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 12:24 Jetty_localhost_55741_datanode____.cj1ayt
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 12:18 Jetty_localhost_55901_datanode____.91pz3
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 13:36 Jetty_localhost_59457_datanode____.gif7tz
drwxrwxr-x. 3 hadoop hadoop 4096 May 22 11:28 Jetty_localhost_59865_datanode____dj2ere
drwx------. 2 root root 4096 May 23 10:55 keyring-dOEsWO
drwx------. 2 root root 4096 Apr 21 02:20 keyring-fR5f6f
drwx------. 2 root root 4096 Apr 21 02:13 keyring-jZCkKD
drwx------. 2 root root 4096 Apr 20 20:07 keyring-RWPvsu
drwx------. 2 root root 4096 May 21 16:18 keyring-Rythlk
drwx------. 2 root root 4096 Apr 25 14:13 keyring-zrMZWC
srwxrwxrwx. 1 MySQL mysql 0 Apr 25 14:17 mysql.sock
drwx------. 2 gdm gdm 4096 May 23 10:55 orbit-gdm
drwx------. 2 root root 4096 May 23 10:56 orbit-root
drwx------. 2 gdm gdm 4096 May 23 10:56 pulse-aQWRK1os9K8n
drwx------. 2 root root 4096 May 23 10:55 pulse-Zd56fb7r0ESa
drwx------. 2 root root 4096 May 23 10:55 virtual-root.OV7MJo
drwx------. 2 root root 4096 May 21 16:18 virtual-root.q1Shey
-rw-rw-r--. 1 hadoop hadoop 5 May 23 11:05 yarn-hadoop-nodemanager.pid
-rw-rw-r--. 1 hadoop hadoop 5 May 23 11:05 yarn-hadoop-resourcemanager.pid
[hadoop@hadoop002 tmp]$
[hadoop@hadoop002 tmp]$ cat hadoop-hadoop-datanode.pid
2619
[hadoop@hadoop002 tmp]$
2. 修改HADOOP_PID_DIR文件的路徑
正常在生產(chǎn)上 pid文件是不能放在/tmp目錄的,因?yàn)?tmp下面的pid文件一個(gè)月會(huì)自動(dòng)刪除一次。所以我們把tmp目錄建在/data/hadoop目錄下面:
2.1 查看 /opt/software/hadoop/sbin/hadoop-daemon.sh 文件,發(fā)現(xiàn)hadoop查找pid是根據(jù) HADOOP_PID_DIR 環(huán)境變量獲取的。
[hadoop@hadoop002 tmp]$ cat /opt/software/hadoop/sbin/hadoop-daemon.sh |grep pid
# HADOOP_PID_DIR 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
[hadoop@hadoop002 tmp]$
2.2 以root創(chuàng)建/data/hadoop/tem 目錄
[hadoop@hadoop002 hadoop]$ exit #退出hadoop
logout
[root@hadoop002 software]# cd /
[root@hadoop002 /]#
[root@hadoop002 /]# mkdir data
[root@hadoop002 /]# cd data/
[root@hadoop002 data]# mkdir hadoop
[root@hadoop002 data]# cd hadoop/
[root@hadoop002 hadoop]# mkdir tmp
[root@hadoop002 hadoop]# ll
total 4
drwxr-xr-x. 2 root root 4096 May 23 14:11 tmp
2.3 /data/hadoop/tem目錄授權(quán)
[root@hadoop002 hadoop]# chmod 777 tmp
[root@hadoop002 hadoop]# ll
total 4
drwxrwxrwx. 2 root root 4096 May 23 14:11 tmp
2.4 修改 /opt/software/hadoop/etc/hadoop/hadoop-env.sh文件里面HADOOP_PID_DIR的環(huán)境變量
[hadoop@hadoop002 hadoop]$ pwd
/opt/software/hadoop/etc/hadoop
[hadoop@hadoop002 hadoop]$ vi hadoop-env.sh
#export HADOOP_PID_DIR=${HADOOP_PID_DIR} #注釋這行
export HADOOP_PID_DIR=/data/hadoop/tmp #添加新路徑
編輯好后,保存退出。
2.5 重啟 sbin/start-dfs.sh
#先停止hadoop服務(wù)
[hadoop@hadoop002 sbin]$ sh stop-dfs.sh
Stopping namenodes on [hadoop002]
hadoop002: no namenode to stop
hadoop002: no datanode to stop
Stopping secondary namenodes [hadoop002]
hadoop002: no secondarynamenode to stop
#再啟動(dòng)hadoop服務(wù)
[hadoop@hadoop002 sbin]$ sh start-dfs.sh
Starting namenodes on [hadoop002]
hadoop002: starting namenode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-hadoop-namenode-hadoop002.out
hadoop002: starting datanode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-hadoop-datanode-hadoop002.out
Starting secondary namenodes [hadoop002]
hadoop002: starting secondarynamenode, logging to /opt/software/hadoop-2.8.1/logs/hadoop-hadoop- secondarynamenode-hadoop002.out
[hadoop@hadoop002 sbin]$
#重啟之前,tmp目錄下沒有文件
[root@hadoop002 ~]# cd /data/hadoop/tmp/
[root@hadoop002 tmp]# ll
total 0
#重啟之后,tmp目錄下生成了pid文件
[root@hadoop002 tmp]# ll
total 12
-rw-rw-r--. 1 hadoop hadoop 5 May 23 14:17 hadoop-hadoop-datanode.pid
-rw-rw-r--. 1 hadoop hadoop 5 May 23 14:17 hadoop-hadoop-namenode.pid
-rw-rw-r--. 1 hadoop hadoop 5 May 23 14:17 hadoop-hadoop-secondarynamenode.pid
以上是“HDFS中pid文件存儲(chǔ)在哪”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章題目:HDFS中pid文件存儲(chǔ)在哪
網(wǎng)頁(yè)路徑:http://m.rwnh.cn/article22/ghsdjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、標(biāo)簽優(yōu)化、營(yíng)銷型網(wǎng)站建設(shè)、關(guān)鍵詞優(yōu)化、微信公眾號(hào)、微信小程序
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)