环境:
CentOS 6.5(64bit)
JDK1.7.0_79(64bit)
Hadoop-2.4.1
问题描述:
安装时无异常,cd到sbin目录下启动start-dfs.sh时控制台报错,如ssh: Could not resolve hostname Java: Name or service not known。起初认为是windows或linux端的hosts配置域名有误,核对后发现无问题。接下来到网上查询了一遍,stackoverflow论坛中有类似贴,hadoop 2.2.0 64bit installing but cannot start与我这边的问题很接近,就尝试着按照贴中方法解决。
经验分享:
ssh: Could not resolve hostname Java: Name or service not known
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
用法见:SSH本机免登陆密码
控制台中出现lib类似问题可能是hadoop无法调取包内第三方类库,以下为解决办法
vi ~/.bashrc 或 /etc/profile,输入
<pre style="margin-top: 0px; margin-bottom: 1em; padding: 5px; border: 0px; font-size: 13px; width: auto; max-height: 600px; overflow: auto; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; word-wrap: normal; color: rgb(36, 39, 41); background-color: rgb(239, 240, 241);"><code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"</code>