1. 程式人生 > >異常解決:Hadoop啟動出現ssh無法解析主機名等錯誤提示

異常解決:Hadoop啟動出現ssh無法解析主機名等錯誤提示

這幾天終於把Hadoop折騰起來了,自從本科畢設做完就再沒接觸過,現在研究生論文又拾起來了,不過以前用的是Hadoop0.20.0,最新的穩定版本已經升到2.7.1了,對於我這停留在原先版本的人來說,改動還是挺大的。

先說一下剛搭建執行時報的錯誤:

WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [Java HotSpot(TM) Client VM warning: You have loaded library /hadoop/hadoop-2.7
.1/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'. SecondaryNameNode] sed: -e expression #1, char 6: unknown option to `s'
-c: Unknown cipher type 'cd' Client: ssh: Could not resolve hostname Client: Temporary failure in name resolution have: ssh: Could not resolve hostname have: Temporary failure in name resolution You: ssh: Could not resolve hostname You: Temporary failure in name resolution Java: ssh: Could not resolve hostname Java: Temporary failure in
name resolution library: ssh: Could not resolve hostname library: Temporary failure in name resolution loaded: ssh: Could not resolve hostname loaded: Temporary failure in name resolution VM: ssh: Could not resolve hostname VM: Temporary failure in name resolution might: ssh: Could not resolve hostname might: Temporary failure in name resolution stack: ssh: Could not resolve hostname stack: Temporary failure in name resolution have: ssh: Could not resolve hostname have: Temporary failure in name resolution VM: ssh: Could not resolve hostname VM: Temporary failure in name resolution fix: ssh: Could not resolve hostname fix: Temporary failure in name resolution to: ssh: Could not resolve hostname to: Temporary failure in name resolution the: ssh: Could not resolve hostname the: Temporary failure in name resolution ……

解決方法:

在shell中輸入 vi /etc/profile或者vi ~/.bash_profile

寫入環境變數

#換成你自己的hadoop安裝目錄,你懂的~
export  HADOOP_HOME=/home/hadoop/labc/hadoop-2.7.1
export  PATH=$PATH:$HADOOP_HOME/bin
export  PATH=$PATH:$HADOOP_HOME/sbin
export  HADOOP_MAPRED_HOME=$HADOOP_HOME
export  HADOOP_COMMON_HOME=$HADOOP_HOME
export  HADOOP_HDFS_HOME=$HADOOP_HOME
export  YARN_HOME=$HADOOP_HOME
#最主要是兩句,我就是敲錯了
export  HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export  HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

配置完記得重新編譯,source /etc/profile或者source ~/.bash_profile