基础环境:
jdk版本:
Hadoop版本:
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
修改机器为静态IP
原来的配置
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=25b39fc8-eace-49ff-bb9b-545a2f9d4533
DEVICE=eno16777736
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
修改后的配置
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.234.100
NETMASK=255.255.255.0
GATEWAY=192.168.234.2
DNS1=192.168.234.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=25b39fc8-eace-49ff-bb9b-545a2f9d4533
DEVICE=eno16777736
ONBOOT=yes
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
IP修改的时候,需要看你网卡是多少
1.点击编辑,选择虚拟网络编辑器
2.显示如下,看到子网地址为192.168.234.0
然后重新启动即可,reboot
创建其它两台机器用克隆的方式即可
1.注意:克隆时,要保证机器是关机状态的
关机后,选择管理-选择克隆,注意克隆时要选择完整克隆
克隆成功以后,需要修改mask的地址
选择设置-网络适配器-点击生成即可
修改主机名称
查看命令:
hostnamectl
修改命令:
hostnamectl set-hostname 主机名;
修改静态IP地址,并且把mask地址去掉
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
为了避免不必要的麻烦,自己练习时,可以先把防火墙都关闭掉
临时关闭
systemctl stop firewalld.service
禁止开机启动
systemctl disable firewalld.service
可以参考我写的关闭防火墙的文章
https://blog.csdn.net/qq_38220334/article/details/105354257
三台机器做主机名称与IP的映射
修改hadoop1的hosts文件
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.234.100 hadoop1
192.168.234.101 hadoop2
192.168.234.102 hadoop3
测试一下能不能ping通,是可以的
配置免密登录
命令:ssh-keygen -t rsa
然后一直回车即可
[root@hadoop1 etc]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
78:49:9b:18:94:3f:71:1e:d9:0e:27:49:92:d8:e2:e7 root@hadoop1
The key's randomart image is:
+--[ RSA 2048]----+
| .+.o.+ |
| .+ +.B o |
| ..o.+ * |
| .=++. . |
| ooS. |
| .E |
| |
| |
| |
+-----------------+
把密钥拷贝到其它的机器上
ssh-copy-id root@hadoop2
然后输入yes,再输入你机器的密码即可配置成功
The authenticity of host 'hadoop2 (192.168.234.101)' can't be established.
ECDSA key fingerprint is ca:4e:1e:9b:bf:dd:40:b3:51:21:41:e6:09:c4:7f:4e.
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@hadoop2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@hadoop2'"
and check to make sure that only the key(s) you wanted were added.
测试,在hadoop1上,直接登录Hadoop2
[root@hadoop1 etc]# ssh hadoop2
Last login: Sun Sep 20 11:05:36 2020 from 192.168.234.1
[root@hadoop2 ~]# exit
登出
Connection to hadoop2 closed.
[root@hadoop1 etc]#
注意:
在Hadoop1上也要配置他自己的免密登录
// An highlighted block
var foo = 'bar';
安装jdk
加压jdk的安装包,修改一下/etc/profile文件即可
再最后位置添加如下;
export JAVA_HOME=/root/soft/jdk18/jdk1.8.0_202
export PATH=$PATH:$JAVA_HOME/bin
让配置文件生效
source /etc/profile
几台机器都要关闭selinux
修改SELINUX=enforcing为SELINUX=disabled
[root@hadoop1 ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted