安装hadoop-3.2.1
安装环境与安装包
设备共3台,IP,系统版本,如下:
haha1 10.1.1.1 centos7.0
haha2 10.1.1.2 centos7.0
haha3 10.1.1.3 centos7.0
hadoop版本 —hadoop-3.2.1
zookeeper已经安装好了,版本apache-zookeeper-3.6.0-bin.tar.gz
jdk版本 —jdk1.8.0_241
安装包下载链接
hadoop:
链接: hadoop-3.2.1.
本次实验选择的安装包是—hadoop-3.2.1
上传安装包并解压,将安装包传送至其他设备:
rz---上传已经下载的hadoop-3.2.1.tar.gz
tar xf hadoop-3.2.1.tar.gz
scp hadoop-3.2.1 [email protected]:/opt/ ---登录对应的设备上进行解压
scp hadoop-3.2.1 [email protected]:/opt/ ---登录对应的设备上进行解压
修改/etc/hosts然后保存退出
scp /etc/hosts [email protected]:/etc/hosts
scp /etc/hosts [email protected]:/etc/hosts
#关闭防火墙
[root@haha1 ~]# systemctl stop firewalld
[root@haha1 ~]# systemctl disable firewalld
[root@haha1 ~]# systemctl mask firewalld
[root@haha1 ~]# systemctl status firewalld
● firewalld.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
[root@haha1 ~]#
配置ssh免密登录
#生成密钥
[root@haha1 ~]# 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:
SHA256:I0xg3WNRtJwgTkmPdgN4RgZakCfDUzWjtCoflaAqDaA root@haha1
The key's randomart image is:
+---[RSA 2048]----+
|..o+BB@oo+o |
|o.**oO=B+o o |
|E .==o=.+.+ |
|.o o + . . |
|+ + o S |
|.o . . . |
| . |
| |
| |
+----[SHA256]-----+
[root@haha1 ~]#
#将密钥发送至需要免密登录的设备(同样将密钥发送至haha2设备上) ---在haha2和haha3上执行同样的操作
[root@haha1 ~]# ssh-copy-id root@haha3
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'haha3 (10.1.1.3)' can't be established.
ECDSA key fingerprint is SHA256:W6ps1scpaQ/LUQJWTPXYOOSVHmiLLpwHuIClKZ6FTIU.
ECDSA key fingerprint is MD5:88:58:8b:06:b0:78:d3:56:e5:5e:4a:10:53:e2:8e:ad.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@haha3's password: 输入一次对应主机密码,后期登录就不需要密码登录了
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@haha3'"
and check to make sure that only the key(s) you wanted were added.
[root@haha1 ~]#
#验证是否免密
[root@haha1 ~]# ssh haha3
Last login: Tue Apr 28 12:30:30 2020 from gateway
[root@haha3 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:0f:0a:6f brd ff:ff:ff:ff:ff:ff
inet 10.1.1.3/24 brd 10.1.1.255 scope global noprefixroute ens32
valid_lft forever preferred_lft forever
inet6 fe80::7e59:dceb:a858:6970/64 scope link tentative noprefixroute dadfailed
valid_lft forever preferred_lft forever
inet6 fe80::725:aa2:40d8:1cee/64 scope link tentative noprefixroute dadfailed
valid_lft forever preferred_lft forever
inet6 fe80::b7a5:75ac:7899:810b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@haha3 ~]# exit
登出
Connection to haha3 closed.
[root@haha1 ~]# ssh 10.1.1.3
Last login: Tue Apr 28 12:31:25 2020 from haha1
[root@haha3 ~]#ssh haha2
Last login: Tue Apr 28 12:30:28 2020 from 10.1.1.254
[root@haha2 ~]# exit
登出
Connection to haha2 closed.
[root@haha1 ~]# ssh 10.1.1.2
Last login: Tue Apr 28 12:32:19 2020 from 10.1.1.1
[root@haha2 ~]#
安装及配置
配置hadoop的环境变量
#保存退出后
source /root/.bash_profile
#将。bash_profile文件传送至其他设备,保证配置一样
[root@haha1 ~]# scp .bash_profile root@haha2:/root/
.bash_profile 100% 282 19.6KB/s 00:00
[root@haha1 ~]# scp .bash_profile root@haha3:/root/
.bash_profile 100% 282 25.1KB/s 00:00
[root@haha1 ~]#
[root@haha1 ~]# ssh haha2
Last login: Tue Apr 28 12:48:50 2020 from 10.1.1.3
[root@haha2 ~]# sou