工学1号馆

home

XX ssh: Could not resolve hostname XX错误解决办法

By Wu Yudong on May 27, 2015

原创文章,转载请注明: 转载自工学1号馆

安装hadoop2.x,启动报错,格式化namenode是成功的,但是在执行sbin/start-dfs.sh 的时候报错,错误信息如下:

hadoop@ubuntu:~/opt/hadoop-2.4.0$ sbin/start-dfs.sh
15/05/27 04:50:59 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /home/hadoop/opt/hadoop-2.4.0/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'.
localhost]
sed: -e expression #1, char 6: unknown option to `s'
guard.: ssh: Could not resolve hostname guard.: Name or service not known
now.: ssh: Could not resolve hostname now.: Name or service not known
-c: Unknown cipher type 'cd'
noexecstack'.: ssh: Could not resolve hostname noexecstack'.: Name or service not known
have: ssh: Could not resolve hostname have: Name or service not known
VM: ssh: Could not resolve hostname vm: Name or service not known
highly: ssh: Could not resolve hostname highly: Name or service not known
fix: ssh: Could not resolve hostname fix: Name or service not known
the: ssh: Could not resolve hostname the: Name or service not known
The: ssh: Could not resolve hostname the: Name or service not known
VM: ssh: Could not resolve hostname vm: Name or service not known
have: ssh: Could not resolve hostname have: Name or service not known
which: ssh: Could not resolve hostname which: Name or service not known
stack: ssh: Could not resolve hostname stack: Name or service not known
You: ssh: Could not resolve hostname you: Name or service not known
loaded: ssh: Could not resolve hostname loaded: Name or service not known
the: ssh: Could not resolve hostname the: Name or service not known
64-Bit: ssh: Could not resolve hostname 64-bit: Name or service not known
Server: ssh: Could not resolve hostname server: Name or service not known
try: ssh: Could not resolve hostname try: Name or service not known
………………………………………………

各种ssh错误不断的刷屏,给人一种很不爽的感觉,咋一看,还以为ssh没有那个啥没有实现无密码登录,搞定一切后发现问题还是没有解决,etc/profile也配置了如下的hadoop相关路径啊!

export HADOOP_HOME=/home/hadoop/opt/hadoop-2.4.0
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOOME/sbin:$HADOOP_HOME/lib

解决办法:

修改etc/profile配置文件,添加:

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

重启机器,再次运行相同的命令没有报错

hadoop@ubuntu:~/opt/hadoop-2.4.0$ jps
3018 DataNode
3218 SecondaryNameNode
2905 NameNode
3320 Jps

其实问题还没有完全解决,在运行的时候还是有一条警告:

15/05/27 04:50:59 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

这是因为机器和jdk都是64位的,但是hadoop的原生库是32位的,所以会出现警告,后面我会介绍方法解决之

如果文章对您有帮助,欢迎点击下方按钮打赏作者

Comments

No comments yet.
To verify that you are human, please fill in "七"(required)