hosts的设置如下
[root@hadoop01 hadoop-2.7.7]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.216.111 hadoop01
192.168.216.112 hadoop02
192.168.216.113 hadoop03
在主机 输入ssh-keygen -t rsa,然后一直enter
[root@hadoop01 hadoop-2.7.7]# 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:
f2:b0:40:7f:38:b4:29:d0:05:91:51:05:93:a3:97:e5 root@hadoop01
The key's randomart image is:
+--[ RSA 2048]----+
| +*=+. |
| ...o.. |
| . o..= |
| o.oo+E |
| o.O S |
| o B |
| . . |
| |
| |
+-----------------+
[root@hadoop01 hadoop-2.7.7]# ll ~/.ssh/
total 12
-rw-------. 1 root root 1675 Sep 29 23:15 id_rsa
-rw-r--r--. 1 root root 395 Sep 29 23:15 id_rsa.pub
-rw-r--r--. 1 root root 1998 Sep 23 06:36 known_hosts
设置ssh免密登录for 主集群服务器
[root@hadoop01 hadoop-2.7.7]# ssh-copy-id hadoop01
root@hadoop01's password:
Now try logging into the machine, with "ssh 'hadoop01'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@hadoop01 hadoop-2.7.7]# ll ~/.ssh/
total 16
-rw-------. 1 root root 395 Sep 29 23:49 authorized_keys
-rw-------. 1 root root 1675 Sep 29 23:15 id_rsa
-rw-r--r--. 1 root root 395 Sep 29 23:15 id_rsa.pub
-rw-r--r--. 1 root root 1998 Sep 23 06:36 known_hosts
[root@hadoop01 hadoop-2.7.7]# ssh hadoop01
Last login: Sun Sep 29 23:46:51 2019 from hadoop01
[root@hadoop01 ~]# exit
设置免密登录for其他的集群,这样我们就可以免密登录所设置的集群了。
[root@hadoop01 hadoop-2.7.7]# ssh-copy-id hadoop02
root@hadoop02's password:
Now try logging into the machine, with "ssh 'hadoop02'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@hadoop01 hadoop-2.7.7]# ssh-copy-id hadoop03
root@hadoop03's password:
Now try logging into the machine, with "ssh 'hadoop03'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[root@hadoop01 hadoop-2.7.7]# ssh hadoop02
Last login: Sun Sep 29 23:50:30 2019 from hadoop01
[root@hadoop02 ~]# exit
logout
Connection to hadoop02 closed.
[root@hadoop01 hadoop-2.7.7]# stop-all.sh
This script is Deprecated. Instead use stop-dfs.sh and stop-yarn.sh
Stopping namenodes on [hadoop01]
hadoop01: stopping namenode
hadoop02: stopping datanode
hadoop03: stopping datanode
hadoop01: stopping datanode
Stopping secondary namenodes [hadoop01]
hadoop01: stopping secondarynamenode
stopping yarn daemons
stopping resourcemanager
hadoop02: stopping nodemanager
hadoop03: stopping nodemanager
hadoop01: stopping nodemanager
no proxyserver to stop
[root@hadoop01 hadoop-2.7.7]# jps
6961 Jps
[root@hadoop01 hadoop-2.7.7]# start-all.sh
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [hadoop01]
hadoop01: starting namenode, logging to /usr/local/hadoop-2.7.7/logs/hadoop-root-namenode-hadoop01.out
hadoop03: starting datanode, logging to /usr/local/hadoop-2.7.7/logs/hadoop-root-datanode-hadoop03.out
hadoop02: starting datanode, logging to /usr/local/hadoop-2.7.7/logs/hadoop-root-datanode-hadoop02.out
hadoop01: starting datanode, logging to /usr/local/hadoop-2.7.7/logs/hadoop-root-datanode-hadoop01.out
Starting secondary namenodes [hadoop01]
hadoop01: starting secondarynamenode, logging to /usr/local/hadoop-2.7.7/logs/hadoop-root-secondarynamenode-hadoop01.out
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop-2.7.7/logs/yarn-root-resourcemanager-hadoop01.out
hadoop02: starting nodemanager, logging to /usr/local/hadoop-2.7.7/logs/yarn-root-nodemanager-hadoop02.out
hadoop03: starting nodemanager, logging to /usr/local/hadoop-2.7.7/logs/yarn-root-nodemanager-hadoop03.out
hadoop01: starting nodemanager, logging to /usr/local/hadoop-2.7.7/logs/yarn-root-nodemanager-hadoop01.out
[root@hadoop01 hadoop-2.7.7]# jps
7653 NodeManager
7741 Jps
7395 SecondaryNameNode
7228 DataNode
7547 ResourceManager
7092 NameNode
[root@hadoop01 hadoop-2.7.7]#
2604



被折叠的 条评论
为什么被折叠?



