CentOS7.4 + Hadoop2.7.5安装配置管理(伪分布式)
Posted ParamousGIS
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7.4 + Hadoop2.7.5安装配置管理(伪分布式)相关的知识,希望对你有一定的参考价值。
1. 规划
1.1. 机器列表
NameNode |
SecondaryNameNode |
DataNodes |
192.168.1.80 |
192.168.1.80 |
192.168.1.80 |
|
|
|
1.2. 机器列表
机器IP |
主机名 |
用户组/用户 |
192.168.1.80 |
centoshadoop.smartmap.com |
hadoop/hadoop |
|
|
|
2. 添加用户
[root@centoshadoop ~]# useradd hadoop
[root@centoshadoop ~]# passwd hadoop
Changing password for user hadoop.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[root@centoshadoop ~]#
3. 设置IP与服务器名映射
[root@centoshadoop ~]# vi /etc/hosts
192.168.1.80 centoshadoop centoshadoop.smartmap.com
并修改Windows中的hosts文件
C:\\Windows\\System32\\drivers\\etc
4. 免密码登录
4.1. 免密码登录范围
要求能通过免登录包括使用IP和主机名都能免密码登录:
1) NameNode能免密码登录所有的DataNode
2) SecondaryNameNode能免密码登录所有的DataNode
3) NameNode能免密码登录自己
4) SecondaryNameNode能免密码登录自己
5) NameNode能免密码登录SecondaryNameNode
6) SecondaryNameNode能免密码登录NameNode
7) DataNode能免密码登录自己
8) DataNode不需要配置免密码登录NameNode、SecondaryNameNode和其它DataNode。
4.2. SSH无密码配置
4.2.1. 所有节点准备密钥
4.2.1.1. 创建密钥对
[hadoop@centoshadoop ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Created directory \'/home/hadoop/.ssh\'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
SHA256:4hSyoWOuj5MS+ME0ukspvAbfowEbv8iL4ZhfFrETtns hadoop@centoshadoop.smartmap.com
The key\'s randomart image is:
+---[RSA 2048]----+
| |
| |
| * . |
| oo O . |
|+++.* o S |
|*B+. * . |
|=X+o+ E |
|%B+=o. |
|@X*. . |
+----[SHA256]-----+
[hadoop@centoshadoop ~]$ ls -la .ssh/
total 8
drwx------ 2 hadoop hadoop 38 Apr 16 21:00 .
drwx------ 3 hadoop hadoop 74 Apr 16 21:00 ..
-rw------- 1 hadoop hadoop 1675 Apr 16 21:00 id_rsa
-rw-r--r-- 1 hadoop hadoop 414 Apr 16 21:00 id_rsa.pub
[hadoop@centoshadoop ~]$
4.2.1.2. 创建存放公钥的文件
[hadoop@centoshadoop ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[hadoop@centoshadoop ~]$ chmod 600 ~/.ssh/authorized_keys
[hadoop@centoshadoop ~]$ ls -la ~/.ssh/
total 12
drwx------ 2 hadoop hadoop 61 Apr 16 21:02 .
drwx------ 3 hadoop hadoop 74 Apr 16 21:00 ..