hadoop 2.x HA 出现ssh不能解析问题记录。
在docker里面安裝hadoop HA 在啟動或者停止的時候報ssh不能解析問題。
問題現象:
發現圖片不清晰:把問題現象粘貼如下:
root@master:/usr/local/hadoop-2.9.1# start-dfs.sh
Starting namenodes on [2018-10-15 09:45:30,412 WARN [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
master slave1]
[main]: ssh: Could not resolve hostname [main]: Name or service not known
(NativeCodeLoader.java:<clinit>(62)): ssh: Could not resolve hostname (nativecodeloader.java:<clinit>(62)): Name or service not known
WARN: ssh: Could not resolve hostname warn: Name or service not known
-: ssh: Could not resolve hostname -: Name or service not known
Unable: ssh: Could not resolve hostname unable: Name or service not known
load: ssh: Could not resolve hostname load: Name or service not known
native-hadoop: ssh: Could not resolve hostname native-hadoop: Name or service not known
for: ssh: Could not resolve hostname for: Name or service not known
2018-10-15: ssh: Could not resolve hostname 2018-10-15: Name or service not known
library: ssh: Could not resolve hostname library: Name or service not known
platform...: ssh: Could not resolve hostname platform...: Name or service not known
your: ssh: Could not resolve hostname your: Name or service not known
using: ssh: Could not resolve hostname using: Name or service not known
where: ssh: Could not resolve hostname where: Name or service not known
builtin-java: ssh: Could not resolve hostname builtin-java: Name or service not known
util.NativeCodeLoader: ssh: Could not resolve hostname util.nativecodeloader: Name or service not known
applicable: ssh: Could not resolve hostname applicable: Name or service not known
classes: ssh: Could not resolve hostname classes: Name or service not known
slave1: starting namenode, logging to /usr/local/hadoop-2.9.1/logs/hadoop-root-namenode-slave1.out
master: starting namenode, logging to /usr/local/hadoop-2.9.1/logs/hadoop-root-namenode-master.out
09:45:30,412: ssh: Could not resolve hostname 09:45:30,412: Name or service not known
to: ssh: Could not resolve hostname to: No address associated with hostname
slave2: starting datanode, logging to /usr/local/hadoop-2.9.1/logs/hadoop-root-datanode-slave2.out
slave1: starting datanode, logging to /usr/local/hadoop-2.9.1/logs/hadoop-root-datanode-slave1.out
Starting secondary namenodes [2018-10-15 09:45:43,878 WARN [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable]
util.NativeCodeLoader: ssh: Could not resolve hostname util.nativecodeloader: Name or service not known
WARN: ssh: Could not resolve hostname warn: Name or service not known
[main]: ssh: Could not resolve hostname [main]: Name or service not known
2018-10-15: ssh: Could not resolve hostname 2018-10-15: Name or service not known
-: ssh: Could not resolve hostname -: Name or service not known
(NativeCodeLoader.java:<clinit>(62)): ssh: Could not resolve hostname (nativecodeloader.java:<clinit>(62)): Name or service not known
Unable: ssh: Could not resolve hostname unable: Name or service not known
09:45:43,878: ssh: Could not resolve hostname 09:45:43,878: Name or service not known
to: ssh: Could not resolve hostname to: No address associated with hostname
native-hadoop: ssh: Could not resolve hostname native-hadoop: Name or service not known
library: ssh: Could not resolve hostname library: Name or service not known
for: ssh: Could not resolve hostname for: Name or service not known
platform...: ssh: Could not resolve hostname platform...: Name or service not known
your: ssh: Could not resolve hostname your: Name or service not known
builtin-java: ssh: Could not resolve hostname builtin-java: Name or service not known
classes: ssh: Could not resolve hostname classes: Name or service not known
where: ssh: Could not resolve hostname where: Name or service not known
applicable: ssh: Could not resolve hostname applicable: Name or service not known
using: ssh: Could not resolve hostname using: Name or service not known
load: ssh: Could not resolve hostname load: Name or service not known
通過報錯現象分析,是由于ssh解析錯誤,但是我的/etc/hosts里面主機名與ip地址的映射關系完全沒問題,這個時候就不能是ssh問題,那就肯定是hadoop本身的問題。
查看上面的圖,看我紅框里面的信息,不難發現ssh把
Starting namenodes on [2018-10-15 09:45:30,412 WARN [main] util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(62)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
master slave1]
這條警告信息當做域名去解析了,所以肯定有問題。
解決辦法:
打開 hadoop路徑/etc/hadoop/log4j.properties 添加如下信息:
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR這條信息的作用就是在log4j里面去除警告,記住是添加。
網上解決其他辦法:(對于我這種情況不合適)
出現上述問題主要是環境變量沒設置好,在~/.bash_profile或者/etc/profile中加入以下語句就沒問題了。
#vi /etc/profile或者vi ~/.bash_profile
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib",
有的答案說不能加這個雙引號:export HADOOP_OPTS=-Djava.library.path=$HADOOP_HOME/lib,但具體怎樣,我也不太清楚,因為這種方法沒有解決掉我問題。所以說很多問題雖然看似跟網上其他人的問題相似,但最終卻不能解決掉自己問題,在這種情況下還得自己好好分析,分析出錯的現象,說實話,我這個問題我也是花了不少時間才發現的,也是由于不細心以及太依賴于百度了。這里記錄一下,也是希望可以幫助到出現類似問題的小伙伴。
然后用source重新編譯使之生效即可!
#source /etc/profile或者source ~/.bash_profile
還有一種情況也會出現類似的警告問題,那就是版本不兼容。比如說你下載的hadoop版本是64位的,但你的系統是32位,或者相反,系統64位,hadoop32位。
查看hadoop版本:
進入到如下目錄:/usr/local/hadoop-2.9.1/lib/native(這是我的hadoop安裝目錄,具體情況看你自己安裝的目錄),
使用ldd或者file命令查看版本:centos系統查看
說明是64位的。
Ubuntu查看:
說明是64位。
file命令也可以查看:
同樣說明hadoop是64位。查看操作系統版本使用uname -a就可以。
解決辦法同樣是在log4j的文件里面加入
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR參考:https://blog.csdn.net/l1028386804/article/details/51538611
轉載于:https://www.cnblogs.com/yjt1993/p/9789761.html
總結
以上是生活随笔為你收集整理的hadoop 2.x HA 出现ssh不能解析问题记录。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: React服务端渲染实现(基于Dva)
- 下一篇: 【hdoj】3007 Buried me