Ubuntu 14.04 LTE下安装Hadoop 1.2.1(集群分布式模式)(5)

hadoop@master:~$ sudo mkdir ~/.ssh
[sudo] password for hadoop:
hadoop@master:~$ sudo chown -R hadoop:hadoop  ~/.ssh
hadoop@master:~$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
36:99:e0:e9:aa:b8:c3:c6:cd:97:59:9f:49:87:0d:bf hadoop@master
The key's randomart image is:
+--[ RSA 2048]----+
|                |
|                |
|      .          |
|    . o +      |
|      o S =      |
|    . o + +    |
|o o  = o + .    |
|.= o =  + E    |
|+o..o            |
+-----------------+
hadoop@master:~/.ssh$ scp authorized_keys slave1:/home/hadoop/.ssh
The authenticity of host 'slave1 (192.168.2.111)' can't be established.
ECDSA key fingerprint is 48:93:30:0d:bb:3a:85:da:46:3f:75:76:3e:b7:42:6a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'slave1,192.168.2.111' (ECDSA) to the list of known hosts.
hadoop@slave1's password:
scp: /home/hadoop/.ssh/authorized_keys: Permission denied
hadoop@master:~/.ssh$ scp authorized_keys slave1:/home/hadoop/.ssh
hadoop@slave1's password:
authorized_keys                              100%  395    0.4KB/s  00:00   
hadoop@master:~/.ssh$ scp authorized_keys slave2:/home/hadoop/.ssh
The authenticity of host 'slave2 (192.168.2.112)' can't be established.
ECDSA key fingerprint is 48:93:30:0d:bb:3a:85:da:46:3f:75:76:3e:b7:42:6a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'slave2,192.168.2.112' (ECDSA) to the list of known hosts.
hadoop@slave2's password:
authorized_keys                              100%  395    0.4KB/s  00:00   
hadoop@master:~/.ssh$

再测试下是否再次ssh连接的时候需要键入密码。结果是不需要的。

hadoop@master:~/.ssh$ ssh slave1
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-42-generic x86_64)

* Documentation:  https://help.ubuntu.com/

0 packages can be updated.
0 updates are security updates.

$ ls -al
total 239436
drwxr-xr-x 12 hadoop hadoop      4096 Jan  9 22:37 .
drwxr-xr-x  4 root  root        4096 Jan  9 22:25 ..
drwx------  2 hadoop hadoop      4096 Jan  9 22:37 .cache
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Desktop
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Documents
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Downloads
-rw-r--r--  1 hadoop hadoop      8980 Dec 27 03:27 examples.desktop
-rw-rw-r--  1 hadoop hadoop  63851630 Dec 30 05:25 hadoop-1.2.1.tar.gz
-rw-rw-r--  1 hadoop hadoop 181260798 Dec 27 06:49 jdk-8u65-linux-x64.tar.gz
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Music
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Pictures
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Public
drwxr-xr-x  2 hadoop hadoop      4096 Jan  9 22:39 .ssh
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Templates
drwxr-xr-x  2 hadoop hadoop      4096 Dec 27 04:19 Videos
$

hadoop@master:~/.ssh$ ssh slave2
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-42-generic x86_64)

* Documentation:  https://help.ubuntu.com/

27 packages can be updated.
23 updates are security updates.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e386ef54f6ced7b3c6d250b30537cfd3.html