启动hadoop报异常Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

原异常:
[zcs2312@hadoop101 sbin]$ ./start-dfs.sh
Starting namenodes on [hadoop101]
hadoop101: Warning: Permanently added ‘hadoop101,192.168.198.101’ (ECDSA) to the list of known hosts.
hadoop101: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Starting datanodes
localhost: Warning: Permanently added ‘localhost’ (ECDSA) to the list of known hosts.
localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
Starting secondary namenodes [hadoop101]
hadoop101: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
原因分析:没有生成、配置公匙,分发给自己
解决方法:
执行以下命令,然后连续点三下回车生成SSH密匙对

ssh-keygen -t rsa

把密匙对分发给本机,让本机可以免密登录

ssh-copy-id $(hostname)

然后再去重新启动hadoop