Hadoop配置免登陆

配置ssh免登陆
    生成ssh免登陆密钥
    cd ~,进入到我的home目录
    cd .ssh/

    ssh-keygen -t rsa (四个回车)
    执行完这个命令后,会生成两个文件id_rsa(私钥)、id_rsa.pub(公钥)
    将公钥拷贝到要免登陆的机器上

    例如拷贝到自己的机器上:cp id_rsa.pub authorized_keys

执行完上述命令之后,在次进入的hadoop的sbin目录下执行./start-all.sh命令则不需要输入密码便可以成功登录了

全部过程如下

[root@001 qiaochi]# cd ~
[root@001 ~]# ls -la
total 76
dr-xr-x---.  7 root root 4096 Aug  3 15:05 .
dr-xr-xr-x. 20 root root  278 Aug  2 09:02 ..
-rw-------.  1 root root 4678 Jul 31 23:51 anaconda-ks.cfg
-rw-------.  1 root root 6958 Aug  3 15:38 .bash_history
-rw-r--r--.  1 root root   18 Dec 29  2013 .bash_logout
-rw-r--r--.  1 root root  176 Dec 29  2013 .bash_profile
-rw-r--r--.  1 root root  176 Dec 29  2013 .bashrc
drwxr-xr-x.  2 root root    6 Aug  3 13:44 .beeline
drwx------.  4 root root   31 Jul 31 16:02 .cache
drwx------.  4 root root   30 Jul 31 16:02 .config
-rw-r--r--.  1 root root  100 Dec 29  2013 .cshrc
drwx------.  3 root root   25 Jul 31 23:52 .dbus
-rw-r--r--.  1 root root  200 Aug  3 15:03 .hivehistory
-rw-r--r--.  1 root root 4686 Jul 31 15:52 initial-setup-ks.cfg
-rw-------.  1 root root  175 Aug  3 15:03 .mysql_history
-rw-------.  1 root root 3719 Jul 31 23:51 original-ks.cfg
drwx------.  2 root root   25 Aug  1 14:57 .ssh
-rw-r--r--.  1 root root  129 Dec 29  2013 .tcshrc
-rw-------.  1 root root 9166 Aug  3 15:04 .viminfo
-rw-------.  1 root root  110 Aug  3 07:58 .xauthprviTZ
[root@001 ~]# cd .ssh
[root@001 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
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:
b2:0e:da:14:4b:de:ef:a8:07:9a:45:ea:19:4c:44:a4 root@001
The key's randomart image is:
+--[ RSA 2048]----+
| oo              |
| ..              |
|E.               |
|  . .            |
| o oo . S        |
|  +oo+ o         |
| . *=.o          |
|  =+ o.o         |
|  . ooo.o        |
+-----------------+
[root@001 .ssh]# ls
id_rsa  id_rsa.pub  known_hosts
[root@001 .ssh]# cp id_rsa.pub authorized_keys
[root@001 .ssh]# ls
authorized_keys  id_rsa  id_rsa.pub  known_hosts
[root@001 .ssh]# ssh qiaochi001
Last login: Fri Aug  3 15:38:32 2018
[root@001 ~]# exit
logout
Connection to 001 closed.
[root@001 .ssh]# cd /hadoop-2.8.0/sbin/
[root@001 sbin]# ./start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [001]
001: starting namenode, logging to /hadoop-2.8.0/logs/hadoop-root-namenode-001.out
localhost: starting datanode, logging to /hadoop-2.8.0/logs/hadoop-root-datanode-001.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /hadoop-2.8.0/logs/hadoop-root-secondarynamenode-001.out
starting yarn daemons
starting resourcemanager, logging to /hadoop-2.8.0/logs/yarn-resourcemanager-001.out
localhost: starting nodemanager, logging to /hadoop-2.8.0/logs/yarn-root-nodemanager-001.out
[root@001 sbin]# jps
22048 DataNode
22768 Jps
21878 NameNode
22423 ResourceManager
22551 NodeManager
22249 SecondaryNameNode

 

你可能感兴趣的:(Hadoop)