环境准备
编译部署3FS之前,需要进行关闭防火墙和设置SELinux、修改hostname与设置Hosts及集群时间同步设置。
关闭防火墙与设置SELinux模式
在所有节点进行该操作。
- 关闭防火墙。
systemctl stop firewalld systemctl disable firewalld systemctl status firewalld

- 设置SELinux为permissive模式。
- 打开“/etc/selinux/config”文件。
vi /etc/selinux/config
- 按“i”进入编辑模式,在文件中修改如下内容。
SELINUX=permissive
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存退出文件。
图1 设置SELinux为permissive模式
- 重启服务器,使配置生效。
- 打开“/etc/selinux/config”文件。
修改hostname与设置hosts
在所有节点进行该操作。
- 根据集群环境规划,按照名称对每个节点进行对应的设置,例如将Meta节点名称修改为如下所示。
hostnamectl --static set-hostname meta
- 将Meta对应的IP地址填入每个节点的“/etc/hosts”。
- 打开“/etc/hosts”文件。
vi /etc/hosts
- 按“i”进入编辑模式,在文件中填入以下信息。
192.168.65.10 meta
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存退出文件。
- 打开“/etc/hosts”文件。
集群时间同步
在所有节点进行该操作。
- 安装NTP与ntpdate工具。
yum install -y ntp ntpdate
- 在所有节点备份旧配置。
cd /etc && mv ntp.conf ntp.conf.bak
- 在Meta节点编辑NTP配置文件。
- 打开NTP配置文件。
vi /etc/ntp.conf
- 按“i”进入编辑模式,参考如下信息编辑配置文件。
restrict 127.0.0.1 restrict ::1 restrict 192.168.65.10 mask 255.255.255.0 server 127.127.1.0 fudge 127.127.1.0 stratum 8 # Hosts on local network are less restricted. restrict 192.168.65.10 mask 255.255.255.0 nomodify notrap
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存退出文件。
- 打开NTP配置文件。
- 在Meta节点开启NTPD服务。
systemctl start ntpd systemctl enable ntpd systemctl status ntpd

- 在除Meta外的节点编辑NTP配置文件。
- 打开NTP配置文件。
vi /etc/ntp.conf
- 按“i”进入编辑模式,在配置文件中添加Meta节点IP地址。
server 192.168.65.10
- 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存退出文件。
- 在除Meta的所有节点强制同步server时间。
ntpdate meta
这里需要等待5min,否则会报错(no server suitable for synchronization found)。
- 在除Meta外的所有节点写入硬件时钟,避免重启后失效。
hwclock -w
- 安装并启动crontab工具。
yum install -y crontabs chkconfig crond on systemctl start crond crontab -e
- 每隔10分钟与Meta节点同步一次时间。
*/10 * * * * /usr/sbin/ntpdate 192.168.65.10
- 打开NTP配置文件。