一、基础环境准备
1、环境说明(安装时配置IP及主机名)
序号 | 主机IP | 主机名 | 系统 | 备注 |
1 | 192.168.3.101 | master1 | rockylinux8.6最小化安装 | 控制节点 |
2 | 192.168.3.102 | master2 | rockylinux8.6最小化安装 | 控制节点 |
3 | 192.168.3.103 | master3 | rockylinux8.6最小化安装 | 控制节点 |
4 | 192.168.3.104 | node1 | rockylinux8.6最小化安装 | 工作节点 |
5 | 192.168.3.105 | node2 | rockylinux8.6最小化安装 | 工作节点 |
6 | 192.168.3.161 | mysql | rockylinux8.6最小化安装及mysql安装 |
注:也可安装双master节点集群
2、关闭selinux,firewalld及swap分区(在五台设备上执行)
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl disable firewalld
swapoff -a
reboot
注:swapoff -a 为临时关闭swap分区。永久关闭swap分区,vi /etc/fstab 注释swap分区一行
3、修改/etc/hosts文件,增加如下三行(五台设备)
cat <<EOF >> /etc/hosts
192.168.3.101 master1
192.168.3.102 master2
192.168.3.103 master3
192.168.3.104 node1
192.168.3.105 node2
EOF
4、更改yum源为阿里云(五台设备执行)
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
-i.bak \
/etc/yum.repos.d/Rocky-*.repo
dnf makecache
5、配置命令补全及vim工具(五台设备执行)
dnf install -y wget bash-completion vim
6、配置免密登录(三台master上执行,可省)
ssh-keygen
for host in { master1 master2 master3 node1 node2 };do ssh-copy-id $host;done
7、配置时间同步(五台设备执行)
dnf install -y chrony
更改 /etc/chrony.conf 配置文件
将pool 2.pool.ntp.org iburst