环境与配置
- centos8
- hadoop 3.3.5
安装步骤
- 创建一个虚拟机,克隆三个虚拟机,master内存改大一点4G,salve内存1Gj
修改主机名和配置静态ip(管理员模式下)(主从机器都要修改)
hostnamectl set-hostname node1 # 修改主机名
sudo passwd root #设置root密码
yum install -y net-tools #安装网络服务
yum install openssh-server -y # 安装ssh服务
vim /etc/sysconfig/network-scripts # 编辑路径下的ens文件
#直接用下面内容覆盖
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=ens160
UUID=41268e0c-948b-445f-b196-3e9b63a85905
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.37.140 # 需要改
NETMASK=255.255.255.0
GATEWAY=192.168.37.2 #需要改
DNS1=8.8.8.8
nmcli c reload(重启网络服务)
init 6 # 重启
参考链接:
https://blog.csdn.net/alfiy/article/details/122279914
修改windows的hosts和linux的host(主从机器都要配置)
vim /etc/hosts # 修改主机映射
# 用下面的内容覆盖
192.168.37.140 master
192.168.37.141 node1
192.168.37.142 node2
192.168.37.143 node3
设置ssh免密登录,((主从机器都要配置))
#编写一个sync_ssh.sh文件,填入下面的内容
#生成ssh私钥
ssh-keygen -f /root/.ssh/id_rsa -N ''
#循环把公钥传递到服务器上,免密登录
for i in node1 node2 node3 master
do
ssh-copy-id $i
done
如果报错 Permission denied (publickey,password)
报错参考:
https://blog.csdn.net/weixin_41891385/article/details/118631106
关闭防火墙/Selinux
# 关闭防火墙
systemctl stop firewalld.service;systemctl disable firewalld.service
# 关闭selinux
vi /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=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
把时间同步成上海时间(主从机器都要)
#从仓库中直接安装
dnf install chrony -y
#启动chrony
systemctl start chronyd.service && systemctl enable chronyd.service
#设置时区 (这步很重要,把时区改成当地时区)
timedatectl set-timezone "Asia/Shanghai"
#编辑配置文件(使系统同步阿里云的时间)
vi /etc/chrony.conf 修改下方内容
#Use public servers from the pool.ntp.org project.
#Please consider joining the pool (http://www.pool.ntp.org/join.html).
#pool 2.centos.pool.ntp.org iburst 注释掉
server ntp.aliyun.com iburst 新增行
server cn.ntp.org.cn iburst 新增行
#重启服务
systemctl restart chronyd.service
#执行时间同步命令
chronyc sources -v
#查看当前系统时间
date