笔者在电脑上配置了Hadoop集群后,电脑上的本地ip发生了改变。在启动集群时,出现不断输入密码的现象。
[hadoop@wh bin]# sh $HADOOP_HOME/sbin/start-all.sh This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh Starting namenodes on [wh] root@wh's password: wh: Authentication failed. root@wh's password: wh: starting datanode, logging to /home/software/hadoop-2.7.7/logs/hadoop-root-datanode-wh.out Starting secondary namenodes [0.0.0.0] root@0.0.0.0's password: 0.0.0.0: starting secondarynamenode, logging to /home/software/hadoop-2.7.7/logs/hadoop-root-secondarynamenode-wh.out starting yarn daemons starting resourcemanager, logging to /home/software/hadoop-2.7.7/logs/yarn-root-resourcemanager-wh.out root@wh's password: wh: starting nodemanager, logging to /home/software/hadoop-2.7.7/logs/yarn-root-nodemanager-wh.out
出现原因:
OpenSSH协议里,ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts;当下次访问相同计算机时,OpenSSH会核对公钥。如果公钥不同,OpenSSH会发出警告,在更改ip后,信息会发生改变,所以出现这次现象。
解决方法:
-
方法一:
rm -rf ~/.ssh/known_hosts
++++++++++++++++++
优点:干净利索
缺点:把其他正确的公钥信息也删除,下次链接要全部重新经过认证
-
方法二:
vi ~/.ssh/known_hosts
删除对应ip的相关rsa信息(本例可知删除53行信息即可)
++++++++++++++++++
优点:其他正确的公钥信息保留
缺点:还要vi,还要找到对应信息,稍微优点繁琐
-
方法三:
清除旧的公钥信息
ssh-keygen -R 192.168.0.100
++++++++++++++++++
优点:快、稳、狠
缺点:没有缺点