RedHat hadoop ssh配置安裝

1Hadoop集羣各節點配置

192.168.232.142 masterjava

192.168.232.144 node2node

192.168.232.146 secondarynamenodeweb

192.168.232.148 node1ssh

2、在master節點生成登錄密鑰

#添加hadoop用戶oop

[root@master1 opt]# groupadd hadoop
[root@master1 opt]# useradd hadoop -g hadoop

ui

#切換Hadoop 用戶下spa

su hadoop .net

cd /home/hadoop/code

#生成公鑰和私鑰orm

ssh-keygen -q -t rsa -N "" -f /home/hadoop/.ssh/id_rsa

ssh-keygen -t rsa

cd /home/hadoop/.ssh

cat id_rsa.pub > authorized_keys

chmod go-wx  authorized_keys

chmod 700 /home/hadoop/.ssh/

注意:一般配置完後沒法登錄的緣由是由於.ssh文件夾和裏邊相關文件權限不正確的緣由。

要注意權限問題。

3、將masterauthorized_keys 複製到  node1:/home/hadoop/.ssh/authorized_keys

[hadoop@master  ~]$ hostname

Master

[hadoop@master  ~]$ ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:0E:6F:B6 

          inet addr:192.168.232.142  Bcast:192.168.232.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fe0e:6fb6/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:1025 errors:0 dropped:0 overruns:0 frame:0

          TX packets:699 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:165818 (161.9 KiB)  TX bytes:99175 (96.8 KiB)

[hadoop@master  ~]$ scp /home/hadoop/.ssh/authorized_keys hadoop@192.168.232.142:/home/hadoop/.ssh/(用戶名@IP:存儲地址)

authorized_keys                               100%  395     0.4KB/s   00:00 

注意:

在配置時,出現以下錯誤:

[hadoop@master ~]$ scp /home/hadoop/.ssh/authorized_keys hadoop@192.168.57.135:/home/hadoop/.ssh
ssh: connect to host 192.168.57.135 port 22: Connection refused
lost connection

緣由:sshd服務沒有啓動,先啓動sshd服務後就沒問題了。

1)、查看服務是否啓用

ps -ef | grep ssh

2)、若是沒有啓用,則要安裝

yum install openssh-server

3)、安裝完以後開啓

/etc/init.d/sshd start

4)、安裝完以後開啓

[root@master Desktop]# /etc/init.d/sshd start
Generating SSH1 RSA host key:                              [  OK  ]
Generating SSH2 RSA host key:                              [  OK  ]
Generating SSH2 DSA host key:                              [  OK  ]
Starting sshd:                                             [  OK  ]
[root@master Desktop]#

若是/etc/init.d/sshd start出現: 

Generating SSH1 RSA host key:                              [FAILED]

解決辦法: 

$ yum search openssh 
$ sudo yum install openssh

若是已經安裝openssh,啓動sshd 

$ sudo /etc/init.d/sshd start 
sshd re-exec requires execution with an absolute path 
[honki@localhost ~]$ sudo service sshd start 
Generating SSH1 RSA host key:                              [  OK  ] 
Generating SSH2 RSA host key:                              [  OK  ] 
Generating SSH2 DSA host key:                              [  OK  ] 
Starting sshd:                                             [  OK  ]

4、修改authorized_keys權限

chmod go-wx .ssh/authorized_keys

5、切換到hadoop用戶登陸

Ssh node1

相關文章
相關標籤/搜索