集群搭建前准备
准备三台服务器
192.168.1.90
192.168.1.91
192.168.1.92
确认三台服务器的硬盘分区
fdisk -l /dev/sdb
创建挂载点
mkdir /data
将硬盘格式化为ext4
mkfs.ext4 /dev/sdb
挂载硬盘分区
mount /dev/sdb /data
自动挂载
echo '/dev/sdb /data ext4 defaults 0 0' >> /etc/fstab
检测及关闭系统 swap
echo "vm.swappiness = 0">> /etc/sysctl.conf
swapoff -a
sysctl -p
关闭防火墙
检查防火墙状态
sudo systemctl status firewalld.service
关闭防火墙服务
sudo systemctl stop firewalld.service
关闭防火墙自动启动服务
sudo systemctl disable firewalld.service
安装 NTP 服务
yum install ntp -y
vi /etc/ntp.conf
#注释掉下面这几个
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#添加常用的授时服务器,允许上层时间服务器主动修改本机时间
server ntp1.aliyun.com
server time1.aliyun.com
# 本地时钟服务器
server 127.127.1.0
fudge 127.127.1.0 stratum 10
重启ntp,设置时区
systemctl start ntpd
systemctl enable ntpd
timedatectl set