1. 在安装好的 Ubuntu 系统下添加具有 sudo 权限的用户。
root@nodeA:~# sudo adduser zyx
Adding user `zyx' ...
Adding new group `zyx' (1001) ...
Adding new user `zyx' (1001) with group `zyx' ...
Creating home directory `/home/zyx' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for zyx
Enter the new value, or press ENTER for the default
Full Name []: ^Cadduser: `/usr/bin/chfn zyx' exited from signal 2. Exiting.
root@nodeA:~#
root@nodeA:~# sudo usermod -G admin -a zyx
root@nodeA:~#
2. 建立 SSH 无密码登陆
(1)namenode 上实现无密码登陆本机
zyx@nodeA:~$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Created directory '/home/zyx/.ssh'.
Your identification has been saved in /home/zyx/.ssh/id_dsa.
Your public key has been saved in /home/zyx/.ssh/id_dsa.pub.
The key fingerprint is:
65:2e:e0:df:2e:61:a5:19:6a:ab:0e:38:45:a9:6a:2b zyx@nodeA
The key's randomart image is:
+--[ DSA 1024]----+
| |
| . |
| o . o |
| o . ..+. |
|. . ..S=. |
|.o o.=o |
|+.. . o... |
|E... . .. |
|.. .o. .. |
+-----------------+
zyx@nodeA:~$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
zyx@nodeA:~$
(2)实现 namenode 无密码登陆其他 datanode
hadoop@nodeB:~$ scp hadoop@nodea:/home/hadoop/.ssh/id_dsa.pub /home/hadoop
hadoop@nodea's password:
id_dsa.pub 100% 602 0.6KB/s 00:00
hadoop@nodeB:~$ cat id_dsa.pub >> .ssh/authorized_keys
评论0
最新资源