ssh: Could not resolve hostname guard.: Name or service not known

第一种情况

今天重新部署了hadoop集群,但是在运行start-dfs.sh 的时候,出现了报错信息。

ssh: Could not resolve hostname with: Name or service not known
library: ssh: Could not resolve hostname library: Name or service not known
18/08/21 17:26:51 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

通过查看log日志,可以大致上确定报错是因为ssh所导致的,但是检查了ssh免密登录的配置发现并没有出现错误。

解决方法:添加hadoop如下部分到环境变量中

编辑:vi /etc/profile
在里面需要添加一行配置,来解决这个问题:

HADOOP_HOME=/opt/module/hadoop-2.5.0
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOOME/sbin:$HADOOP_HOME/lib
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"

然后再source /etc/profile;就会解决此问题!

第二种情况

在使用命令start-all 启动hadoop报 Name or service not knownstname 错误,原因在于IP进行SSH登录的时候总提示:

The authenticity of host '192.168.0.31' can't be established.
RSA key fingerprint is 52:9b:e2:62:93:01:88:e6:46:a8:16:68:52:91:8a:ea.
Are you sure you want to continue connecting (yes/no)?

屏蔽设置,添加如下两行配置:

vi /etc/ssh/ssh_config


Host *
GSSAPIAuthentication yes

#If this option is set to yes then remote X11 clients will have full access to the original X11 display. As virtually no X11 client supports the mode correctly we set this to yes.
    ForwardX11Trusted yes
    BatchMode yes
    StrictHostKeyChecking no
    SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT

关于如何配置ssh免密登录的配置:
https://blog.csdn.net/Victory_Lei/article/details/81776120`

你可能感兴趣的:(大数据,Hadoop)