hadoop 配置ssh

用namenode做cm server,要配置ssh 无密码登录,访问datanode。


--1.需要在namenode生成密钥

[root@master01 ~]#  ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1a:10:38:c7:5d:dd:6b:f8:32:c5:a8:68:b5:ff:66:1d root@slave07
The key's randomart image is:
+--[ RSA 2048]----+
|   o.. ... .     |
|  o o..   . .    |
|   o.      + .   |
|     .  . o =    |
|      .oSo +     |
|      ooo o . E  |
|     ..  . o . . |
|          . o .  |
|           +.    |
+-----------------+


--2.在nn中复制公钥  cp id_rsa.pub authorized_keys
[root@master01 .ssh]# pwd
/root/.ssh 
[root@master01 .ssh]# ls
id_rsa  id_rsa.pub  known_hosts
[root@master01 .ssh]# cp id_rsa.pub authorized_keys 
[root@master01 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts



--3.在dn中生成 .ssh目录 (注意: 这里主要是为了得到/root/.ssh/ 这个目录)

[root@slave07 ~]#  ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1a:10:38:c7:5d:dd:6b:f8:32:c5:a8:68:b5:ff:66:1d root@slave07
The key's randomart image is:
+--[ RSA 2048]----+
|   o.. ... .     |
|  o o..   . .    |
|   o.      + .   |
|     .  . o =    |
|      .oSo +     |
|      ooo o . E  |
|     ..  . o . . |
|          . o .  |
|           +.    |
+-----------------+
[root@slave07 ~]# 


--4. 把nn的公钥 传到 dn中 /root/.ssh/ 下(这里以slave07为例)

[root@master01 .ssh]# scp authorized_keys root@slave07:/root/.ssh/
root@192.168.156.28's password: 
authorized_keys                                                                        100%  395     0.4KB/s   00:00    
[root@master01 .ssh]# 


----5.现在可以ssh  dn了(第一次需要输入yes,确认下)

[root@master01 .ssh]# ssh slave07
The authenticity of host 'slave07 (192.168.156.28)' can't be established.
RSA key fingerprint is a0:16:4d:76:9a:d9:2b:3f:0c:5c:9b:41:fe:19:a5:4e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'slave07' (RSA) to the list of known hosts.
Last login: Wed Jun 15 22:49:21 2016 from 192.168.156.199
[root@slave07 ~]# 

--6. 再次从master01 到 slave07,就无需任何提示。

[root@slave07 ~]# exit;
logout
Connection to slave07 closed.
[root@master01 .ssh]# ssh slave07
Last login: Wed Jun 15 22:57:22 2016 from master01
[root@slave07 ~]# 

--7.完成。


注: 如果安装节点超过10以上,50台,请写成shell脚本自动完成  ssh免密钥登录。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值