VMWare环境配置
舟率率 12/17/2023 VMWare
- VMWare虚拟机安装 (opens new window)
- 阿里云盘:软件包/自建集群/帮人搭环境/VMWare虚拟机安装/
- 外网设置 (opens new window)
- 阿里云盘:软件包/自建集群/帮人搭环境/外网设置/
VMWare的NAT网络设置 VM8网络设置
# VMWare 环境安装
此处仅展示刚装好虚拟机需要执行的步骤,具体的环境安装请参照项目:bigdata-environment
# 预装软件
yum install -y autoconf automake bzip2 bzip2-devel db4-devel gcc gcc-c++ gdbm-devel libaio libffi-devel libglvnd-glx libpcap-devel libtool make nc ncurses-devel net-tools net-tools.x86_64 numactl openssh openssh-clients openssh-server openssl-devel pcre-devel postgresql-devel readline-devel sqlite-devel sshpass telnet-server.x86_64 telnet.x86_64 tk-devel unzip vim wget xinetd.x86_64 xz-devel zlib-devel
# 添加映射关系(建立集群时,需要将其他集群机器也加入其中)
# 向文件 /etc/hosts 追加以下内容
echo "192.168.130.100 master" >> /etc/hosts
cat /etc/hosts
# 配置主机名hostname
# 向文件 /etc/sysconfig/network 追加以下内容
echo "HOSTNAME=master" >> /etc/sysconfig/network
cat /etc/sysconfig/network
# 关闭和禁用防火墙
# 直接关闭防火墙
systemctl stop firewalld
# 禁止firewall开机启动
systemctl disable firewalld
# 查看状态
systemctl status firewalld
# 重启网络
service network restart
# 重启虚拟机
reboot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 三节点配置免密
在 /etc/ssh/sshd_config 中新增配置
echo "RSAAuthentication yes" >> /etc/ssh/sshd_config
echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
systemctl restart sshd.service
1
2
3
2
3
依次在各节点执行
ssh-keygen -t rsa -P ''
1
在master节点执行
touch ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
# scp ~/.ssh/authorized_keys {用户名}@{节点2的hostname}:~/.ssh/
scp ~/.ssh/authorized_keys root@worker1:~/.ssh/
1
2
3
4
2
3
4
在worker1节点执行
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys root@worker2:~/.ssh/
1
2
2
在worker2节点执行
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys root@master:~/.ssh/
scp ~/.ssh/authorized_keys root@worker1:~/.ssh/
1
2
3
2
3
依次在各节点执行
chmod 600 ~/.ssh/authorized_keys
1
在master节点依次执行
ssh root@master
ssh root@worker1
ssh root@worker2
1
2
3
2
3
在worker1节点依次执行
ssh root@worker1
ssh root@master
ssh root@worker2
1
2
3
2
3
在worker2节点依次执行
ssh root@worker2
ssh root@master
ssh root@worker1
1
2
3
2
3
# 完全克隆虚拟机
- 修改虚拟机MAC地址,生成一个新的MAC地址
- 修改hostname
perl -pi -e 's/master/slave2/g' /etc/sysconfig/network
cat /etc/sysconfig/network
1
2
2
- 修改ip
perl -pi -e 's/192.168.130.100/192.168.130.102/g' /etc/sysconfig/network-scripts/ifcfg-ens33
cat /etc/sysconfig/network-scripts/ifcfg-ens33
1
2
2
- 修改/etc/hosts
192.168.130.100 slave2
1
cat /etc/hosts
1
- 重启网络 service network restart
- 重启虚拟机 reboot
注意
- 完全克隆后,如果安装了spark,需要修改/export/software/spark-3.1.2-bin-hadoop3.2/conf/spark-env.sh
export SPARK_LOCAL_IP=本机IP
1
- 对unix.sh修改后,重新配置免密