参考:hadoop3.3.4集群安装部署_hwbays的博客-CSDN博客
1.环境准备:
3台centos7服务器 master stave1 stave2 配置:
1.1修改host
vim /etc/hosts
192.168.240.128 master
192.168.240.129 stave1
192.168.240.130 stave2
1.2.修改主机名
登录master,输入
hoatnamectl set-hostname master
登录stave1,输入
hoatnamectl set-hostname stave1
登录stave2,输入
hoatnamectl set-hostname stave2
1.3. 安装远程同步工具rsync,用于服务器间同步配置文件
yum install -y rsync
1.4.设置ssh
cd ~/.ssh/
提示:bash: cd: /root/.ssh/: No such file or directory
ssh设置密钥时出现的问题,解决方法为:先用yum安装ssh,然后再生成密钥
yum install -y openssl openssh-server
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cd ~/.ssh/
ssh-keygen -t rsa #生成免密登录公私钥,根据提示按回车或y
ssh-copy-id -i ~/.ssh/id_rsa.pub root@master #将本机的公钥上传至master 机器上,实现对master 机器免密登录
ssh-copy-id -i ~/.ssh/id_rsa.pub root@stave1
ssh-copy-id -i ~/.ssh/id_rsa.pub root@stave2
1.5.安装JDK
1.5.1查看系统是否自带JDK
java -version
[root@ ~]# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
1.5.2 查看本地安装包文件
rpm -qa | grep java
1.5.3删除相关文件
rpm -e –nodeps java*-openjdk-*
1.5.4检查
bash:java:command not found...
表示卸载成功
1.5.6下载jdk18
1.5.7 解压安装到/export/servers/目录下
tar -zxvf jdk-18.0.2_linux-x64_bin.tar.gz -C /export/servers
1.5.8修改/etc/profile文件,添加java路径
vim /etc/profile
export JAVA_HOME=/export/servers/jdk-18.0.2
export PATH=$JAVA_HOME/bin:$PATH