ssh: Could not resolve hostname localhost: nodename nor servname provided, or not known

 

 

搭建Hadoop伪集群的时候,需要ssh 免密登录,当执行hadoop启动脚本是时候报错: 

ssh: Could not resolve hostname localhost: nodename nor servname provided, or not known_第1张图片

 

解决

一、运行SSH

 

   (1)ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

   (2)cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

   (3)ssh localhost

 

      要保证:  ~/.ssh需要是700权限 (chmod 700 ~/.ssh)
                       authorized_keys需要是644权限(chmod 644 ~/.ssh/authorized_keys)

二、配置/etc/hosts文件(很关键)

    (1) vi /etc/hosts

    (2) 添加 127.0.0.1  localhost

    (3) wq!   

然后再重启机器就成功了。

你可能感兴趣的:(mac)