hadoop搭建时配置SSH免密登陆,解决RSA无法使用问题

由于配置手册中的免密登陆配置略显复杂,所以找到了一个相对简单的配置方式

1、生成RSA公钥

$ ssh-keygen -t rsa    一直回车生成一对公用密钥

$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/beifeng/.ssh/id_rsa):

Created directory '/home/beifeng/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/beifeng/.ssh/id_rsa.

2、

把自己的密钥拷贝给集群中所有机器

在centos001

$ ssh-copy-id centos001

$ ssh-copy-id centos002

$ ssh-copy-id centos003

centos002

$ ssh-keygen -t rsa

$ ssh-copy-id centos001

$ ssh-copy-id centos002

$ ssh-copy-id centos003 

centos003

$ ssh-keygen -t rsa

$ ssh-copy-id centos001

$ ssh-copy-id centos002

$ ssh-copy-id centos003

3、一般情况下使用RSA就可以了,可是有时还会踩到坑,在已经配置RSA且所有主机可以互访的情况下,ambari仍然提示公钥问题无法链接集群中其他主机

这时候就需要使用DSA了

on host1:

rm -rf /root/.ssh

ssh-keygen -t dsa

cat /root/.ssh/id_dsa.pub >> /root/.ssh/authorized_keys

scp /root/.ssh/id_dsa.pub host2:/root/

scp /root/.ssh/id_dsa.pub host3:/root/

on host2:

rm -rf /root/.ssh

ssh-keygen -t dsa

cat /root/id_dsa.pub >> /root/.ssh/authorized_keys

on host3:

rm -rf /root/.ssh

ssh-keygen -t dsa

cat /root/id_dsa.pub >> /root/.ssh/authorized_keys

host1:/root/.ssh/id_dsa This's the file which you need.

之后在ambari中输入DSA公钥,便不会报错了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值