千家信息网

分布式文件系统--------GlusterFS最佳实战

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,1. 背景GlusterFS 是一个开源的分布式文件系统,具有强大的横向扩展能力,通过扩展能够支持数PB存储容量和处理数千客户端。GlusterFS借助TCP/IP或InfiniBand RDMA(一
千家信息网最后更新 2026年11月03日分布式文件系统--------GlusterFS最佳实战

1. 背景

GlusterFS 是一个开源的分布式文件系统,具有强大的横向扩展能力,通过扩展能够支持数PB存储容量和处理数千客户端。GlusterFS借助TCP/IP或InfiniBand RDMA(一种支持多并发链接的"转换线缆"技术)网络将物理分布的存储资源聚集在一起,使用单一全局命名空间来管理数据。GlusterFS基于可堆叠的用户空间设计,可为各种不同的数据负载提供优异的性能。

GlusterFS支持运行在任何标准IP网络上标准应用程序的标准客户端


2. 优势

 * 线性横向扩展和高性能

* 高可用性

* 全局统一命名空间

* 弹性哈希算法和弹性卷管理

* 基于标准协议

* 完全软件实现(Software Only)

* 用户空间实现(User Space)

* 模块化堆栈式架构(Modular Stackable Architecture)

* 原始数据格式存储(Data Stored in Native Formats)

* 无元数据服务设计(No Metadata with the Elastic Hash Algorithm)


3. 环境

server_1 CentOS 7.2.1511 (Core) 192.168.60.201

server_2 CentOS 7.2.1511 (Core) 192.168.60.202


4. 安装

* server_1 安装centos-release-gluster

[root@server_1 ~]# yum install centos-release-gluster -y


* server_1 安装 glusterfs-server

[root@server_1 ~]# yum install glusterfs-server -y

* server_1 启动 glusterfs-server 服务

[root@server_1 ~]# systemctl start glusterd


* server_2 安装centos-release-gluster

[root@server_2 ~]# yum install centos-release-gluster -y


* server_2 安装 glusterfs-server

[root@server_2 ~]# yum install glusterfs-server -y


* server_2 启动 glusterfs-server 服务

[root@server_2 ~]# systemctl start glusterd


5. 建立信任池 [ 信任单向建立即可 ]

* server_1 对 server_2 建立信任

[root@server_1 ~]# gluster peer probe 192.168.60.202peer probe: success.


 * 查看信任池建立情况

[root@server_1 ~]# gluster peer statusNumber of Peers: 1Hostname: 192.168.60.202Uuid: 84d98fd8-4500-46d3-9d67-8bafacb5898bState: Peer in Cluster (Connected)[root@server_2 ~]# gluster peer statusNumber of Peers: 1Hostname: 192.168.60.201Uuid: 20722daf-35c4-422c-99ff-6b0a41d07eb4State: Peer in Cluster (Connected)

6. 创建分布式卷

* server_1 和 server_2 创建数据存放目录

[root@server_1 ~]# mkdir -p /data/exp1[root@server_2 ~]# mkdir -p /data/exp2


  * 使用命令创建分布式卷,命名为test-volume

[root@server_1 ~]# gluster volume create test-volume 192.168.60.201:/data/exp1 192.168.60.202:/data/exp2 forcevolume create: test-volume: success: please start the volume to access data


  * 查看卷信息

[root@server_1 ~]# gluster volume info test-volume Volume Name: test-volumeType: DistributeVolume ID: 457ca1ff-ac55-4d59-b827-fb80fc0f4184Status: CreatedSnapshot Count: 0Number of Bricks: 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp1Brick2: 192.168.60.202:/data/exp2Options Reconfigured:transport.address-family: inetnfs.disable: on[root@server_2 ~]# gluster volume info test-volume Volume Name: test-volumeType: DistributeVolume ID: 457ca1ff-ac55-4d59-b827-fb80fc0f4184Status: CreatedSnapshot Count: 0Number of Bricks: 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp1Brick2: 192.168.60.202:/data/exp2Options Reconfigured:transport.address-family: inetnfs.disable: on


  * 启动卷

[root@server_1 ~]# gluster volume start test-volumevolume start: test-volume: success



7. 创建复制卷  [ 对比Raid 1 ]

* server_1 和 server_2 创建数据存放目录

[root@server_1 ~]# mkdir -p /data/exp3[root@server_2 ~]# mkdir -p /data/exp4


* 使用命令创建复制卷,命名为repl-volume

[root@server_1 ~]# gluster volume create repl-volume replica 2 transport tcp 192.168.60.201:/data/exp3 192.168.60.202:/data/exp4 forcevolume create: repl-volume: success: please start the volume to access data


* 查看卷信息

[root@server_1 ~]# gluster volume info repl-volume Volume Name: repl-volumeType: ReplicateVolume ID: 1924ed7b-73d4-45a9-af6d-fd19abb384cdStatus: CreatedSnapshot Count: 0Number of Bricks: 1 x 2 = 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp3Brick2: 192.168.60.202:/data/exp4Options Reconfigured:transport.address-family: inetnfs.disable: on[root@server_2 ~]# gluster volume info repl-volume Volume Name: repl-volumeType: ReplicateVolume ID: 1924ed7b-73d4-45a9-af6d-fd19abb384cdStatus: CreatedSnapshot Count: 0Number of Bricks: 1 x 2 = 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp3Brick2: 192.168.60.202:/data/exp4Options Reconfigured:transport.address-family: inetnfs.disable: on


  * 启动卷

[root@server_1 ~]# gluster volume start repl-volumevolume start: repl-volume: success


8. 创建条带卷 [ 对比Raid 0 ]

* server_1 和 server_2 创建数据存放目录

[root@server_1 ~]# mkdir -p /data/exp5[root@server_2 ~]# mkdir -p /data/exp6


* 使用命令创建复制卷,命名为raid0-volume

[root@server_1 ~]# gluster volume create raid0-volume stripe 2 transport tcp 192.168.60.201:/data/exp5 192.168.60.202:/data/exp6 forcevolume create: raid0-volume: success: please start the volume to access data


* 查看卷信息

[root@server_1 ~]# gluster volume info raid0-volume Volume Name: raid0-volumeType: StripeVolume ID: 13b36adb-7e8b-46e2-8949-f54eab5356f6Status: CreatedSnapshot Count: 0Number of Bricks: 1 x 2 = 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp5Brick2: 192.168.60.202:/data/exp6Options Reconfigured:transport.address-family: inetnfs.disable: on[root@server_2 ~]# gluster volume info raid0-volume Volume Name: raid0-volumeType: StripeVolume ID: 13b36adb-7e8b-46e2-8949-f54eab5356f6Status: CreatedSnapshot Count: 0Number of Bricks: 1 x 2 = 2Transport-type: tcpBricks:Brick1: 192.168.60.201:/data/exp5Brick2: 192.168.60.202:/data/exp6Options Reconfigured:transport.address-family: inetnfs.disable: on


  * 启动卷

[root@server_1 ~]# gluster volume start raid0-volumevolume start: raid0-volume: success



9. 客户端应用

* 安装glusterfs-cli

[root@client ~]# yum install glusterfs-cli -y

* 创建挂载目录

[root@client ~]# mkdir /mnt/g1 /mnt/g2 /mnt/g3


* 挂载卷

[root@server_1 ~]# mount.glusterfs 192.168.60.201:/test-volume /mnt/g1[root@server_1 ~]# mount.glusterfs 192.168.60.202:/repl-volume /mnt/g2[root@server_1 ~]# mount.glusterfs 192.168.60.201:/raid0-volume /mnt/g3


10. 扩展卷

* 创建存放目录

[root@server_1 ~]# mkdir -p /data/exp9


  * 扩展卷

[root@server_1 ~]# gluster volume add-brick test-volume 192.168.60.201:/data/exp9 forcevolume add-brick: success


  * 重新均衡

[root@server_1 ~]# gluster volume rebalance test-volume startvolume rebalance: test-volume: success: Rebalance on test-volume has been started successfully. Use rebalance status command to check status of the rebalance process.ID: 008c3f28-d8a1-4f05-b63c-4543c51050ec



11. 总结



以需求驱动技术,技术本身没有优略之分,只有业务之分。


数据 目录 标准 空间 分布式 信息 命令 客户 客户端 技术 存储 支持 服务 全局 弹性 横向 用户 网络 应用 管理 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网科技企业 天津市摩尔互联网科技 华中科技大学互联网 无线互联网科技 赫美联合互联网科技 狮子座互联网科技培训 互联网科技公司介绍 互联网校园科技培训 荆州市昕露互联网络科技有限公司 广州市恰铎互联网科技有限公司 国大互联网教育科技有限公司工作 互联网新科技动漫ppt素材 华夏恒生互联网科技013171 山东有哪些互联网科技公司 深圳互联网科技的发展 杭州披云加互联网科技有限公司 云鲸互联网络科技有限公司 华人运通互联网科技公司 黑龙江互联网科技公司 互联网科技创新方面的资料 中国互联网科技工作委员会毛军 上海挚品互联网科技 华中科技大学互联网 恒生科技互联网指数分析 移动互联网年度科技创新 江苏苏星互联网科技有限公司 南京一网一红互联网科技有限公司 抖集互联网科技技术咨询 互联网科技机房 伍佰万互联网科技是干嘛的
0