尧图精选

GlusterFS 集群部署记录 文档

🕒 发布时间:2026/9/25 19:55:57 📁 来源:尧图网络
部署日期2026-09-22部署方式基于项目脚本GFS脚本-尹斌自动化执行软件版本CentOS 7.9 GlusterFS 7.9一、集群拓扑主机名IP角色数据盘brick 路径状态node110.10.10.41存储节点/dev/sdb~sde各10G/tat/sdeglusterd 运行中node210.10.10.42存储节点/dev/sdb~sde各10G/tat/sdeglusterd 运行中node310.10.10.43存储节点/dev/sdb~sde各10G/tat/sdeglusterd 运行中node410.10.10.44存储节点/dev/sdb~sde各10G/tat/sdeglusterd 运行中client10.10.10.40客户端无挂载点 /test/dis-rep已挂载卷网络VMware NAT网关 10.10.10.2主机名解析通过 /etc/hosts5 条映射。二、部署过程1. 环境准备5 台克隆机均完成关闭 firewalld、禁用 SELinux、设置主机名hostnamectl set-hostname。写入 /etc/hosts 的 5 条映射10.10.10.40 client / .41 node1 / .42 node2 / .43 node3 / .44 node4。验证任意节点互 ping 主机名全部可达。2. 存储节点数据盘源机初始仅 1 块系统盘按脚本要求给 node1~4 各补挂 4 块 10G 虚拟数据盘。每台执行printf n\np\n1\n\n\nw\n | fdisk /dev/sd$imkfs.xfs -f /dev/sd${i}1mkdir -p /tat/sd$iecho /dev/sd${i}1 /tat/sd$i xfs defaults 0 0 /etc/fstabmount -a结果/dev/sdb~sde 分区为 sdb1~sde1xfs 挂载到 /tat/sdb~sde。3. yum 源配置关键原机只有一个本地源 local.repobaseurlfile:///mnt缺少 glusterfs-server 包且 yum 缓存失效后 local 源不可用报 repodata/repomd.xml 错误。处理改用阿里云源base / updates / extras / epel / gluster7并将失效 local.repo 改名停用。其中 GlusterFS 7 来自 CentOS Storage SIG 镜像baseurlhttps://mirrors.aliyun.com/centos/7/storage/x86_64/gluster-7/4. 安装服务端node1~4yum install -y glusterfs-server glusterfs glusterfs-fuse glusterfs-rdmasystemctl enable glusterd systemctl start glusterd结果4 台 glusterd 均 activeglusterfs 7.9。5. 组建集群node1gluster peer probe node2gluster peer probe node3gluster peer probe node4gluster peer status # 3 个 peer 全部 Connected遇到问题刚 probe 完 node3 处于 Accepted peer request、node4 被识别为残留 IP建卷报 Host nodeX is not in Peer in Cluster state。等待状态收敛后重试成功。6. 创建分布式复制卷node1gluster volume create dis-rep replica 2 \node1:/tat/sde node2:/tat/sde node3:/tat/sde node4:/tat/sde forcegluster volume start dis-rep结果Type Distributed-Replicate2×2 4 brick全部 online。7. 客户端部署clientyum install -y glusterfs glusterfs-fusemkdir -p /test/dis-repmount.glusterfs node1:dis-rep /test/dis-rep结果挂载成功挂载点 20G。写入 5 个测试文件 test1~5.txt各 5M hello.txt 验证读写。三、验证结果1. 客户端视角[rootclient ~]# ls -lh /test/dis-rep/test1.txt test2.txt test3.txt test4.txt test5.txt hello.txt 各 5Mdf -h | grep dis-rep → node1:dis-rep 20G /test/dis-rep2. 数据分布体现「分布式复制卷」特性存储节点brick 内文件node1test1.txt test3.txt test4.txtnode2test1.txt test3.txt test4.txt与 node1 一致复制node3test2.txt test5.txtnode4test2.txt test5.txt与 node3 一致复制复制关系node1↔node2 成组、node3↔node4 成组replica 2。分布关系test1/3/4 在一组test2/5 在另一组分布式。3. 卷状态gluster volume info dis-rep → Type: Distributed-Replicate, Status: Startedgluster volume status dis-rep → 4 brick 全部 online状态列 Y四、问题与解决记录问题现象解决本地源缺 glusterfs-serveryum 找不到 glusterfs-server改用阿里云 Storage SIG gluster-7 源local 源缓存失效yum 报 file:///mnt repodata/repomd.xml 错误改名停用 local.repopeer 状态未收敛建卷报 nodeX not in Peer in Cluster等待 5~10 秒或重新 probe克隆机 DHCP 残留 IPnode4 在 peer 列表显示为 10.10.10.135不影响集群静态 IP 已生效五、后续建议可继续做「自愈实验」手动 kill 一个 brick 的 glusterfsd 进程验证复制卷高可用与 heal。如需让各节点只保留静态 IP可执行systemctl restart network清理 DHCP 残留地址。
上一篇/下一篇内容由系统自动关联 返回资讯列表 →